zoukankan      html  css  js  c++  java
  • 前段开发 react native tab功能

    import React, { Component } from 'react';
    import {
    
      StyleSheet,
      Text,
      View,
      Image,
    
    } from 'react-native';
    import TabNavigator from 'react-native-tab-navigator'
    
    import { Platform } from 'react-native'
    
    //这里 是四个底部tab 切换页面
    import Home from './src/assembly/myhome'
    import Newrn from './src/assembly/publicrn'
    import News from "./src/assembly/news";
    import About from "./src/assembly/about";
    import My from "./src/assembly/my";
    //判断安卓手机还是iOS手机
    // let paddingTop = 10;
    if (Platform.OS === 'android') {
        // alert(1)
    }else{
       // paddingTop = 400;
    }
    
    
    
    const instructions = Platform.select({
      ios: 'Press Cmd+R to reload,
    ' +
        'Cmd+D or shake for dev menu',
      android: 'Double tap R on your keyboard to reload,
    ' +
        'Shake or press menu button for dev menu',
    });
    
    type Props = {};
    export default class App extends Component<Props> {
    
    
      constructor(props){
        super(props);
        this.state = {
            selectedTab: '首页'
        }
      }
    
    
    
    
      render() {
        return (
        //判断安卓 iOS 屏幕上面兼容20像素
    <View style={[styles.android,Platform.OS == 'ios' ? styles.ios :Platform.OS == 'android']}> <TabNavigator> <TabNavigator.Item selected={this.state.selectedTab === '11'} title="首页" titleStyle={styles.tabText} selectedTitleStyle={styles.selectedTabText} renderIcon={() => <Image style={styles.icon} source={require(".png")} />} renderSelectedIcon={() => <Image style={styles.icon} source={require(".png")} />} onPress={() => this.setState({ selectedTab: '11' })}> <View> <Home></Home> </View> </TabNavigator.Item> <TabNavigator.Item selected={this.state.selectedTab === '22'} title="22" titleStyle={styles.tabText} selectedTitleStyle={styles.selectedTabText} renderIcon={() => <Image style={styles.icon} source={require(".png")} />} renderSelectedIcon={() => <Image style={styles.icon} source={require(".png")} />} onPress={() => this.setState({ selectedTab: '11' })}> <View> <News></News> </View> </TabNavigator.Item> <TabNavigator.Item selected={this.state.selectedTab === '33'} title="33" titleStyle={styles.tabText} selectedTitleStyle={styles.selectedTabText} renderIcon={() => <Image style={styles.icon} source={require(".png")} />} renderSelectedIcon={() => <Image style={styles.icon} source={require(".png")} />} onPress={() => this.setState({ selectedTab: '33' })}> <View> <My></My> </View> </TabNavigator.Item> <TabNavigator.Item selected={this.state.selectedTab === '44'} title="44" titleStyle={styles.tabText} selectedTitleStyle={styles.selectedTabText} renderIcon={() => <Image style={styles.icon} source={require(".png")} />} renderSelectedIcon={() => <Image style={styles.icon} source={require(".png")} />} onPress={() => this.setState({ selectedTab: '44' })}> <View> <About></About> </View> </TabNavigator.Item> </TabNavigator> </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor:'#ccc', // paddingTop: paddingTop }, android: { flex: 1, backgroundColor:'green', }, ios:{ flex: 1, backgroundColor:'#fff', marginTop:21 }, tabText: { color: "#666666", fontSize: 13 }, selectedTabText: { color: "#ff8a00", fontSize: 13 }, icon: { 25, height: 25, } });
  • 相关阅读:
    20.谱聚类
    19.受限玻尔兹曼机(Restricted Boltzmann Machine)
    18.高斯过程回归(GPR)
    17.贝叶斯线性回归(Bayesian Linear Regression)
    16.高斯网络(GN)
    15.条件随机场(CRF)
    14(2).线性动态系统---粒子滤波 particle filter
    比较IE6的不同之处,与IE8 IE11 比较
    doctype声明、浏览器的标准、怪异等模式
    通过HTML条件注释判断IE版本的HTML语句详解<!--[if IE]> <![endif]-->
  • 原文地址:https://www.cnblogs.com/chen527/p/9609539.html
Copyright © 2011-2022 走看看