We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
router:
const tabbaroption = { activeTintColor: 'red', inactiveTintColor: '#999999', showIcon: true, style: { justifyContent:'center', alignItems:'center', backgroundColor:'#fff' }, indicatorStyle: { opacity: 0 }, iconStyle:{ paddingBottom:0, paddingTop:0, padding:0, marginTop:0, marginBottom:0, width:SCALE(40), height:SCALE(40), }, labelStyle:{ paddingTop:0, paddingBottom:SCALE(10), marginTop:0, padding:0, fontSize:FONT(10), color:Color.C888888 }, tabStyle: { height:Platform.OS==='ios'?SCALE(98):SCALE(100), justifyContent:'center', alignItems:'center' } }; //我发起的请假选项 const TabContainer = TabNavigator( { Home: { screen: HomeContainer, }, Project: {screen: ProjectContainer,}, Profile: {screen: ProfileContainer,}, }, { lazy: true, swipeEnabled: false, tabBarPosition: 'bottom', animationEnabled: true, backBehavior: 'none', // 按 back 键是否跳转到第一个Tab(首页), none 为不跳转 tabBarOptions: tabbaroption, tabBarComponent:props => <Tab {...props}/>, });
Tab:
export default class Tab extends Component { static defaultProps = { }; renderItem = (route, index) => { const { navigation, jumpToIndex, } = this.props; const focused = index === navigation.state.index; const color = focused ? this.props.activeTintColor : this.props.inactiveTintColor; let TabScene = { focused:focused, route:route, tintColor:color }; return ( <TouchableOpacity key={route.key} style={styles.tabItem} onPress={() => jumpToIndex(index)} > <View style={styles.tabItem}> {this.props.renderIcon(TabScene)} <Text style={{ ...styles.tabText,marginTop:SCALE(10),color }}>{this.props.getLabel(TabScene)}</Text> </View> </TouchableOpacity> ); }; render(){ // console.log('Tab this.props',this.props); const {navigation,} = this.props; const {routes,} = navigation.state; return ( <View style={styles.tab}> {routes && routes.map((route,index) => this.renderItem(route, index))} </View> ); } } const styles = { tab:{ borderTopWidth:StyleSheet.hairlineWidth, borderTopColor:Color.dddddd, width:WIDTH, height: Platform.OS==='ios'?SCALE(90):SCALE(100), backgroundColor:'white', flexDirection:'row', justifyContent:'space-around', alignItems:'center' }, tabItem:{ width:SCALE(100), alignItems:'center', justifyContent:'center' }, tabText:{ marginTop:SCALE(13), fontSize:FONT(10), color:Color.C7b7b7b }, tabTextChoose:{ color:Color.f3474b }, tabImage:{ width:SCALE(42), height:SCALE(42), }, }
实现如下效果: 参考: http://blog.csdn.net/u014041033/article/details/79046736 https://github.com/wuyunqiang/AndroidToRN/blob/master/testApp/RN_src/component/Tab.js
The text was updated successfully, but these errors were encountered:
No branches or pull requests
Uh oh!
There was an error while loading. Please reload this page.
router:
Tab:
实现如下效果:
参考:
http://blog.csdn.net/u014041033/article/details/79046736
https://github.com/wuyunqiang/AndroidToRN/blob/master/testApp/RN_src/component/Tab.js
The text was updated successfully, but these errors were encountered: