采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
2-7里面讲到的 TabNavigator在使用的时候都会警告。找到用createBottomTabNavigator 替代TabNavigator, 但是2-8里TabBarBottom又不能用了。。
参考代码:
//这里改动 import {createBottomTabNavigator, BottomTabBar} from 'react-navigation-tabs'; class TabBarComponent extends React.Component { constructor(props) { super(props); this.theme = { tintColor: props.activeTintColor, updateTime: new Date().getTime() } } render() { const {routes, index} = this.props.navigation.state;//这里改动 const {theme} = routes[index].params; if (theme && theme.updateTime > this.theme.updateTime) { this.theme = theme; } /** * custom tabBarComponent * https://github.com/react-navigation/react-navigation/issues/4297 */ return ( //这里改动 <BottomTabBar {...this.props} activeTintColor={this.theme.tintColor || this.props.activeTintColor} /> ); } } export const AppTabNavigator = createBottomTabNavigator({//这里改动 ...
其他地方不变。
登录后可查看更多问答,登录/注册
一个真实的上线项目,一次完整的开发过程,全面掌握React Native技术
5.0k 12
1.5k 9
1.9k 8
1.8k 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号