我正在学习本机响应,并且确实设法启动并运行了2个标签栏。 现在,我尝试添加第三个选项卡,但是每次尝试添加第三个选项卡时,我只会看到2个选项卡。我有些困惑,希望有人可以提供一些编码帮助。
import React from 'react';
import {
createMaterialTopTabNavigator,
} from 'react-navigation';
import FoldersList from '../screens/FoldersList';
const Routes = {
Home: {
screen: (props) => <FoldersList {...props} tabIndex={0}/>,
navigationOptions: {
title: 'Home'
}
},
MyNewTab: {
screen: (props) => <FoldersList {...props} tabIndex={1} createFolderTitle='Create new tab folder' />,
navigationOptions: {
title: 'My New Tab'
}
},
MyThirdTab: {
screen: (props) => <FoldersList {...props} tabIndex={2} createFolderTitle='Create new tab folder' />,
navigationOptions: {
title: 'My Third Tab'
}
}
}
const routeConfig = {
swipeEnabled: false
}
export default TabNavigator = createMaterialTopTabNavigator({
...Routes
}, routeConfig);
答案 0 :(得分:0)
您的代码有语法错误,可能无法编译。更改以下内容:
export default TabNavigator = createMaterialTopTabNavigator({
到
export default createMaterialTopTabNavigator({