react-native-tab-navigator的简单实用

1.执行命令
yarn add react-native-tab-navigator

2. 导入组件
import TabNavigator from 'react-native-tab-navigator';
3. 实用示例
export default class imooc_gp extends Component {

  constructor(props){
   super(props);
   //状态切换
   this.state = {
       selectedTab: 'home',
   }

  }

  render() {
    return (
      
        
           }
              renderSelectedIcon={() => }
              badgeText="1"
              onPress={() => this.setState({ selectedTab: 'home' })}>
              {homeView}
          
           }
              renderSelectedIcon={() => }
              onPress={() => this.setState({ selectedTab: 'profile' })}>
              {profileView}
          
        
      
    );
  }
}

你可能感兴趣的:(react-native-tab-navigator的简单实用)