文章目录
react native navigator
https://github.com/exponentjs/react-native-tab-navigator
http://www.tuicool.com/articles/A3eUZr
npm
import TabNavigator from ‘react-native-tab-navigator’
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| <TabNavigator tabBarStyle={{ height: tabBarHeight, overflow: 'hidden' }} sceneStyle={{ paddingBottom: tabBarHeight }} > <TabNavigator.Item selected={this.state.selectedTab === 'Home'} title="首页" renderIcon={() => <Image source={require('./images/star2.png')} style= {styles.img}/>} renderSelectedIcon={() => <Image source={require('./images/star1.png')} style= {styles.img}/>} onPress={() => this.setState({ selectedTab: 'Home' })}> <Find/> </TabNavigator.Item> <TabNavigator.Item selected={this.state.selectedTab === 'Me'} title="我" renderIcon={() => <Image source={require('./images/me2.png')} style= {styles.img}/>} renderSelectedIcon={() => <Image source={require('./images/me1.png')} style= {styles.img}/>} onPress={() => this.setState({ selectedTab: 'Me' })}> <Me /> </TabNavigator.Item>
</TabNavigator>
|