android上显示不出来,ios可以显示
来源:1-5 项目底部导航菜单开发
KarelRobot
2017-03-26
android上显示不出来,ios模拟器上可以显示在中间有一个,代码如下:
<View style={styles.container}> <TabNavigator> <TabNavigator.Item style={styles.page} selected={this.state.selectedTab === 'home'} title="Home" renderIcon={() => <Image style={styles.image} source={require('./res/images/ic_polular.png')}/>} renderSelectedIcon={() => <Image style={styles.image} source={require('./res/images/ic_polular.png')}/>} badgeText="1" onPress={() => this.setState({selectedTab: 'home'})}> <View style={styles.page}> <Text>111</Text> </View> </TabNavigator.Item> <TabNavigator.Item style={styles.page} selected={this.state.selectedTab === 'profile'} title="Profile" renderIcon={() => <Image style={styles.image} source={require('./res/images/ic_trending.png')}/>} renderSelectedIcon={() => <Image style={styles.image} source={require('./res/images/ic_trending.png')}/>} onPress={() => this.setState({selectedTab: 'profile'})}> <View style={styles.page1}> <Text>222</Text> </View> </TabNavigator.Item> </TabNavigator> </View>
写回答
2回答
-
CrazyCodeBoy
2017-03-27
应该不是上述代码的问题,按照如下带Android和iOS运行正常,看是否是你的央视问题:
render() { return ( <View style={styles.container}> <TabNavigator> <TabNavigator.Item style={styles.page} selected={this.state.selectedTab === 'home'} title="Home" renderIcon={() => <Image style={styles.image} />} renderSelectedIcon={() => <Image style={styles.image} />} badgeText="1" onPress={() => this.setState({selectedTab: 'home'})}> <View style={styles.page}> <Text>111</Text> </View> </TabNavigator.Item> <TabNavigator.Item style={styles.page} selected={this.state.selectedTab === 'profile'} title="Profile" renderIcon={() => <Image style={styles.image} />} renderSelectedIcon={() => <Image style={styles.image} />} onPress={() => this.setState({selectedTab: 'profile'})}> <View style={styles.page1}> <Text>222</Text> </View> </TabNavigator.Item> </TabNavigator> </View> ); }
00 -
KarelRobot
提问者
2017-03-29
已经解决,是样式的问题。谢谢啦
012017-05-24
相似问题