采纳答案成功!
向帮助你的同学说点啥吧!感谢那些助人为乐的人
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} =
.props.navigation.state;
const {theme} = routes[index].params;
if
(theme && theme.updateTime >
.theme.updateTime) {
.theme = theme;
/**
* custom tabBarComponent
* https://github.com/react-navigation/react-navigation/issues/4297
*/
return
(
<BottomTabBar
{...
.props}
activeTintColor={
.theme.tintColor ||
.props.activeTintColor}
/>
);
export const AppTabNavigator = createBottomTabNavigator({
...
其他地方不变。
登录后可查看更多问答,登录/注册
一个真实的上线项目,一次完整的开发过程,全面掌握React Native技术
4.7k 12
1.2k 9
1.3k 9
1.6k 8
1.4k 7
购课补贴联系客服咨询优惠详情
慕课网APP您的移动学习伙伴
扫描二维码关注慕课网微信公众号