我正在尝试在我的React Native App中使用导航。我已经安装了V2。以下设置不显示任何选项卡。
Navigation.events().registerAppLaunchedListener(()=>{
Navigation.setRoot({
root: {
topTabs: {
children:[{
stack: {
children: [
{
component: {
name: 'news.MainScreen',
text: 'tab1',
passProps: {
text: 'This is tab 1'
},
options: {
topTab: {
text: "tab 1",
testID: 'NO_IDEA'
}
}
},
},
{
component: {
name: 'news.SplashScreen',
text: 'tab2',
passProps: {
text: 'This is tab 6'
}
},
options: {
topTab: {
text: "tab 21",
testID: 'NO_IDEA_1'
}
}
},
]
}
}],
}
}
})
});
当我编译我的应用程序时,这是结果:
欢迎所有建议。
看起来你只有一个孩子。只尝试第一个标签(在水龙头中没有堆叠)
Navigation.setRoot({
root: {
topTabs: {
children: [
{
component: {
name: "screens.tab1",
options: {
topTab: {
title: "Tab 1"
}
}
}
},
{
component: {
name: "screens.tab2",
options: {
topTab: {
title: "Tab 2"
}
}
}
},
{
component: {
name: "screens.tab3",
options: {
topTab: {
title: "Tab 3"
}
}
}
}
]
}
}
});