我在bottemtabbar中使用堆栈导航器,并且希望在堆栈导航器中设置默认屏幕。我使用的是React本机导航v5,所以我必须创建如下所示的导航器:
const Stack = createStackNavigator();
<Stack.Navigator
screenOptions={{
headerShown: false,
}}>
<Stack.Screen name="Feed" component={Feed} />
<Stack.Screen name="Profile" component={Profile} />
<Stack.Screen name="NewPost" component={NewPost} />
</Stack.Navigator>我尝试使用initialRouteName,但是当我在Stack.Screen中打开一个屏幕时,然后返回到Tab中的Stack.Screen,然后返回到Stack.Screen的选项卡,它仍然显示了我上次查看的Stack.Screen(我希望它每次都显示一个特定的开始屏幕)。
航海家:
选项卡-导航器:
发布于 2022-01-11 05:15:07
你试过了吗
<Stack.Navigator initialRouteName="Feed"></Stack.Navigator>https://stackoverflow.com/questions/70658904
复制相似问题