我正在使用React-Navigation v 5.0.1,我在Stack导航器中嵌套了一个Drawer导航器,如下所示:
MainStack.js
function MainStack() {
return(
<Stack.Navigator>
<Stack.Screen name="Splash" component={Splash} />
<Stack.Screen name="Login" component={Login} />
<Stack.Screen name="HomeDrawerStack" component={HomeDrawerStack} />
</Stack.Navigator>
)
}
HomeDrawerStack.js
function HomeDrawerStack() {
return (
<Drawer.Navigator>
<Drawer.Screen name="Home" component={Home} />
</Drawer.Navigator>
)
}
当我点击主页屏幕上的注销按钮时,如何导航到登录屏幕并重置/清除所有其他屏幕? (因此它会在其他屏幕上触发componentWillUnmount)