react-native-tab-navigator

/**
 * Sample React Native App
 * https://github.com/facebook/react-native
 * @flow
 */

import React, { Component } from 'react';
import {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  Image
} from 'react-native';

import TabNavigator from 'react-native-tab-navigator';

export default class D20170510 extends Component {
    constructor(props){
        super(props);
        this.state = {
           defaultSelected:'1'
        }
    }
  render() {
    return (
        

             {
                    return (
                        {'666'}
                    );
                }}
                renderIcon={() => {
                    return (
                        
                    );
                }}
                renderSelectedIcon={() => {
                    return (
                        
                    );
                }}
                selected={this.state.defaultSelected == 1}
                title={'第一个'}
                onPress={() => {
                    this.setState({
                        defaultSelected:1
                    });
                }}
                >
                {}
            

             {
                    this.setState({
                        defaultSelected:2
                    });
                }}
                >
                {}
            

             {
                    this.setState({
                        defaultSelected:3
                    });
                }}
                >
                {}
            


        
    );
  }
}


class Main1 extends Component {
    render (){
        return (
            
                {'main1'}
            
        );
    }
}

class Main2 extends Component {
    render (){
        return (
            
                {'main2'}
            
        );
    }
}

class Main3 extends Component {
    render (){
        return (
            
                {'main3'}
            
        );
    }
}



const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor:'#fff'
  },
  welcome: {
    fontSize: 20,
    textAlign: 'center',
    margin: 10,
  },
  instructions: {
    textAlign: 'center',
    color: '#333333',
    marginBottom: 5,
  },
});

AppRegistry.registerComponent('D20170510', () => D20170510);

你可能感兴趣的:(react-native-tab-navigator)