-
Notifications
You must be signed in to change notification settings - Fork 24.6k
reset state on new props #1300
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
reset state on new props #1300
Conversation
Thank you for your pull request and welcome to our community. We require contributors to sign our Contributor License Agreement, and we don't seem to have you on file. In order for us to review and merge your code, please sign up at https://code.facebook.com/cla - and if you have received this in error or have any questions, please drop us a line at [email protected]. Thanks! |
Thank you for signing our Contributor License Agreement. We can now accept your code for this (and any) Facebook open source project. Thanks! |
I agree that it would be ideal if Navigator were more declarative. But I am pretty sure this would be problematic with the current system because any re-rendering outside of the navigator will cause the routes to be blown away by the initial routes. An example: If I create a navigator with scene A, and then scene A causes scene B to be pushed, any re-render of the navigator would cause scene B to disappear! I'm happy to discuss this more, but I think this approach will be problematic without making some deeper changes. |
fair enough. thoughts on resetTo accepting an array of routes? perhaps a seperate name? I'd be happy to make a pull request. |
Sorry for the delayed response here. We have |
ah! |
Great! Let me know if you have an idea for a better name/naming convention. We might want to have two sets of nav actions with consistent names. They would have the same effect on the stack, but one set of actions would happen instantly and the other set animates. |
This change adds a section for debugging application state (Redux and MobX-State-Tree, the two most popular state management systems in React Native) using Reactotron. See discussion in Discord #website for more info.
So, this isn't really the perfect pull request to do this, but what I'm trying to accomplish is making the Navigator more declarative. If I change the initialRouteStack (might need to introduce a new routes prop so that the naming isn't confusing), it would be nice if the navigator rerendered with the new stack. Obviously blowing away the existing stack wouldn't be ideal in all cases, but I can't think of a better way to blow away the existing navigator and replace it with a new one with the updated stack of routes.
Alternatively, it might be nice to have
resetTo
accept an array of routes.