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>


http://szimg.mukewang.com/58d787460001df4911301754.jpg

写回答

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>
    );
}


0
0

KarelRobot

提问者

2017-03-29

已经解决,是样式的问题。谢谢啦

0
1
浅叶随风
请问是如何解决的
2017-05-24
共1条回复

React Native技术精讲与高质量上线App开发

一个真实的上线项目,一次完整的开发过程,全面掌握React Native技术

1577 学习 · 727 问题

查看课程