我有一个标签栏,我想这样做,以便在按下其中一个标签时,它将把屏幕推到堆栈上(覆盖标签栏)。它基本上是StackNavigator和BottomTabNavigator的组合。我尝试了此操作,但它给我一个错误,提示“导航”未定义。
App.js
const AppContainer = createStackNavigator(
{
SnapTalk: Tabs,
Post: {
screen: PostScreen
}
},
{
mode: "modal",
headerMode: "none",
initialRouteName: "Post"
}const AppContainer = createStackNavigator(
{
SnapTalk: Tabs,
Post: {
screen: PostScreen
}
},
{
mode: "modal",
headerMode: "none",
initialRouteName: "Post"
}
NavBar.js
<AppTabs.Screen
name="Post"
component = {PostScreen}
options={{
tabBarIcon: ({ color, size}) => (
<Icon name="ios-add-circle-outline" size={30} color= {color} />
)
}}
listeners={{
tabPress:
navigation.navigate("Post")
}}
>