gpt4 book ai didi

javascript - 在 React Native Navigation V2 中添加 Tab 导航

转载 作者:行者123 更新时间:2023-11-29 23:19:05 25 4
gpt4 key购买 nike

我正在尝试让导航在我的 React Native 应用程序中正常工作。我已经安装了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'
}
}
},
]
}
}],
}
}
})

});

当我编译我的应用程序时,结果如下:

result of the code above

欢迎所有建议。

最佳答案

看起来你只有一个 tap child。仅尝试第一个选项卡(点击时没有堆栈)

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"
}
}
}
}
]
}
}
});

关于javascript - 在 React Native Navigation V2 中添加 Tab 导航,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/51420763/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com