This is the root navigator
export const AppNavigator = StackNavigator({
Splash: { screen: Splash },
Dashboard: { screen: DashboardDrawer }
});
const DashboardDrawer = DrawerNavigator({ DashboardScreen: {
screen: StackNavigator({
A: { screen: A },
B: { screen: B },
C: { screen: C },
D: { screen: D },
}
}, {
contentComponent: DashboardDrawerComponent,
drawerWidth: 280
});
I have 4 screens - A, B, C, D in my stack. I want to jump from D to A. (or D to any screen) I referred to the following react-navigation documentation-https://reactnavigation.org/docs/navigators/navigation-prop#goBack-Close-the-active-screen-and-move-back
The above doc. states that to go from screen D to screen A (popping D, C, and B) you need to supply a key to goBack FROM, in my case B, like this
navigation.goBack(SCREEN_KEY_B)
So, my question is from where should I get the key for a specific screen? I checked my root navigation object, and it shows me some dynamically generated key for each screen. How can I specify my own keys for the screens?