采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
在render里面获取them的时候 老师的代码是这么写的 const { routes, index } = this.props.navigationState 但是我看this.props里面没有navigationState这个属性 所以我是这么写的const { routes, index } = this.props.navigation.state然后再去找里面的theme
但是这样写的就出现了下面的问题 这个在网上都找不到解决办法:
新版本的tabNavigator的api有所变更,可以参考一下代码:
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} /> ); }
非常感谢!
登录后可查看更多问答,登录/注册
一个真实的上线项目,一次完整的开发过程,全面掌握React Native技术
5.1k 12
1.6k 9
2.0k 8
1.9k 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号