Open yilinjuang opened 4 years ago
I was reading through the docs and noticed the same issue with this example.
The example that is in the docs right now actually calls navigate("Settings")
while it is in the same Navigator if I am correct. Therefore, nothing will bubble up, if I read this correctly.
I think the example should be something like this:
In the above example, when calling
navigate('Messages')
, insideFeed
screen, the nested tab navigator will handle it, but if you callnavigate('Settings')
, the parent stack navigator will handle it.
This will call navigate('Messages')
from the Feed
screen, which is in the same Navigator. This will be handled locally, by the Home component's Tab Navigator.
Calling navigate('Settings')
from the Feed
screen will actually bubble up to the Stack Navigator, since the Home component's Tab Navigator does not have a 'Settings' screen.
I made a PR for this: #740
P.S. This is my first open source PR so if any information you need is missing or the docs also need to be updated for previous versions I'll update my PR! :ok_hand:
https://reactnavigation.org/docs/nesting-navigators/#navigation-actions-are-handled-by-current-navigator-and-bubble-up-if-couldnt-be-handled
This example doesn't sound right to me but not sure how to correct it.