-
Notifications
You must be signed in to change notification settings - Fork 24.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NavigatorIOS crashes when "pushing" to a new route #1241
Comments
(bump) |
Found a workaround. Looks like using nested See diff at https://github.com/sharathprabhal/TestNavigatorIOS/pull/1/files What is the purpose of the |
I encountered the same problem. How do I solve this? |
See above comment. I solved it by using |
Closing as it seems to be fixed! @christopherdro #fridaytriage |
Ran into this today. Solution was to pass the root NavigatorIOS component to the nested component as a prop, e.g. |
i am facing same problem can we solve this without shifting from NavigatorIos to Navigator |
Can one use nested |
change 首页的NavigatorIOS改为Navigator
@brentvatne this still happens over a year later. It'd be great to be able to use a NavigatorIOS inside a NavigatorIOS. Having two different navigation stacks is a common pattern in iOS and is pretty much a must for our use case. The test repo provided by the OP is still relevant (https://github.com/sharathprabhal/TestNavigatorIOS) I have just played around with this a bit and have a fix. Will post a pull request in a minute. |
With nested NavigatorIOS components: ``` <NavigatorIOS initialRoute={{ component: ComponentWithNavigatorIOSInSubtree title: 'xyz' }}> ``` Navigating (via push etc.) in ComponentWithNavigatorIOSInSubtree's `navigator` caused an invariant error, making apps with this structure unusable. The reason was that the `navigationComplete` nativeEvent was being propagated to the outer Navigator due to React's automatic event bubbling. The event bubbling was automatic and almost certain unintentional, so preventing it should not cause unintended side-effects. See demo repo at facebook#1241 for more a more detailed example.
Summary: With nested NavigatorIOS components: ``` <NavigatorIOS initialRoute={{ component: ComponentWithAnotherNavigatorIOSInSubtree title: 'xyz' }}> ``` Navigating (via push etc.) in ComponentWithAnotherNavigatorIOSInSubtree's `navigator` caused an invariant error, making apps with this structure unusable. The reason was that the `navigationComplete` nativeEvent was being propagated to the outer Navigator due to React's automatic event bubbling, making the outer NavigatorIOS incorrectly think it was holding navigation stack state inconsistent with its native UINavigationController. Concretely, if the outer navigation stack is empty except for its initial state and something is pushed onto the inner stack, the outer NavigatorIOS suddenly complains that it has 2 items on its stack rather than 1. In reality, the outer Navigator still only has 1 item on its stack but the inner Navigator's event (containing information about the inner Navigator) incorrectly bubbles up and reaches the outer Navigator too. Closes #9828 Differential Revision: D4030167 Pulled By: ericvicenti fbshipit-source-id: d04de3d5b70b4862a78610c92701ebdab2b047dd
Error message:
The red screen is displayed as soon as a new route is pushed.
Sample app available at https://github.com/sharathprabhal/TestNavigatorIOS
The text was updated successfully, but these errors were encountered: