gpt4 book ai didi

react-navigation - react-navigation Stack Navigator 和 SwitchNavigator 有什么区别?

转载 作者:行者123 更新时间:2023-12-03 20:24:51 25 4
gpt4 key购买 nike

关闭。这个问题需要更多 focused .它目前不接受答案。












想改进这个问题?更新问题,使其仅关注一个问题 editing this post .

3年前关闭。




Improve this question




在撰写本文时,Docs不要提供 SwitchNavigator 的描述的目的。

我已经尝试同时使用 StackNavigatorSwitchNavigator可以互换,我个人无法发现差异。虽然我确定有。

谁能解释 SwitchNavigator 的额外好处是什么?结束StackNavigator ?或者一个可能使用它而不是另一个的场景?

最佳答案

这是来自 React Navigation 的描述:

The purpose of SwitchNavigator is to only ever show one screen at a time. By default, it does not handle back actions and it resets routes to their default state when you switch away. This is the exact behavior that we want from the authentication flow: when users sign in, we want to throw away the state of the authentication flow and unmount all of the screens, and when we press the hardware back button we expect to not be able to go back to the authentication flow. We switch between routes in the SwitchNavigator by using the navigate action.



来源: https://reactnavigation.org/docs/auth-flow.html

关于react-navigation - react-navigation Stack Navigator 和 SwitchNavigator 有什么区别?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49417757/

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