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

What is the difference between react-navigation's StackNavigator and SwitchNavigator?

截至撰写本文时,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