-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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
[Navigator] don't render twice for every navigation #3016
Conversation
This will fix that bug, but it will also prevent the current scene from getting re-rendered when the Navigator gets re-rendered. Is that the intention? I'm concerned because people probably rely on that behavior to some extent |
Yes. I think it is reasonable to not rely on navigator to re-render the current scene. isn't it? Now that i think about it, is there a case where you would want navigator to re-render the current scene? I would listen to store change and re-render based on the state. |
So you'd get the same old copy of rendered scene even when this.state.presentedIndex had changed. If the scene can be expensive to render, the scene itself should use PureRenderMixin to protect itself from being overly rendered by the navigator. |
this.sate.presentedIndex is private so that shouldn't break anything ideally. I maybe wrong. Happy to close this. |
I think the consensus here is that we should leave this behaviour as-is for now. Navigator is being worked on internally at fb right now so let's see how that shakes out and then maybe revisit this later on @chirag04 |
👍 |
@chirag04 I'm using react-native 0.13.2. I'm still facing the issue everything gets called for each element in routestack, my navigation bar get's rendered for all route in routes and so takes the properties of the first route. Did you solve the issue? |
I see this issue with CameraRollView and Navigator. If you click an image and navigate to a new view, the roll is re-rendered, and again if you go back to the roll, which is not nice to look at for CameraRoll The pending commit chirag04@31e2f40 by @chirag04 fixes the problem for me and makes transitions in general smoother An option to disable re-render of an existing scene would be good. I don't expect the current scene to rerender as it moves to the next. |
@adriansprod There are side effects to that commit of mine. navigator Adding |
I'm having similar issues where the extra I've tried doing something like this in my
However, that breaks the Additionally I need to be able to update the parent component to the Navigator to be able to change the So to sum up, for smooth animation and pop functionality that preserves the previous route (and as a bonus not having to keep track of when what should render) I think chirag04@31e2f40 get's the job done. Would be awesome if the side effects were fixed and the PR accepted. |
@ericvicenti @hedgerwang seems like a lot of people are running into this. Not re-rendering the previous scene on every transition would be awesome. Wondering if i can do anything to still get this merged without the side-effects of breaking |
I'm running into this on RN 0.20.0. I'm seeing the previous and the current route get passed to @chirag04 For the suggested |
i am also facing the same issue with RN 0.41.2. is there any solution to this ? |
fixes #952
cc @hedgerwang @ericvicenti @ide