Xyz*_*zor 5 javascript navigation react-native redux react-navigation
I've been using react-navigation for almost half a year, but I still don't understand the nesting part of it. How the navigation prop is inherited, how to communicate, etc..
I created a demo on snack, from the redux example app.
I'd like to understand these:
What happens with the navigation prop if I navigate to a child navigator?
How to navigate from a child navigators screen to the parents screen or the parents other child's screen
How to remove a child navigator from the state?
The simplest example: On a login event I reset the navigator with the Main StackNavigator. The problem with this is, that I have to rebuild manually the whole Main state. It would be much easier If I could just remove somehow the Auth StackNavigator and keep the Main Stack.
I wrapped the Main navigation (StackNavigator) component with a redux component as the doc says. It works fine until I navigate into a child component. The navigation props niavigate method stops dispatching redux actions.
I have a Component and a DrawerNavigator inside a StackNavigator. If i navigate into the DrawerNavigator (there is only 1 screen there) from the Component, I can't go back to that Component with this:
this.props.navigation.goBack()
Run Code Online (Sandbox Code Playgroud)
The odd part is that its only impossible inside the screen's component. From the screen's header component its working.
| 归档时间: |
|
| 查看次数: |
777 次 |
| 最近记录: |