-
Notifications
You must be signed in to change notification settings - Fork 24.3k
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] push should unmount component or have an event to listen to. Pop should remount the component it's moving to. #1731
Comments
Yeah @vjeux @brentvatne are there any plans or workaround to implement this? My use case:
What I am looking for is |
Another possibility - passing prop |
We're working on improving the event flow for the navigation. For instance:
|
@hedgerwang sounds good! |
Hi there! This issue is being closed because it has been inactive for a while. But don't worry, it will live on with ProductPains! Check out it's new home: https://productpains.com/post/react-native/navigator-push-should-unmount-component-or-have-an-event-to-listen-to-pop-should-remount-the-component-its-moving-to |
Is it fixed? Or just closed because it's okay to have a memory leak within an app? |
@pukhalski - man, we are doing our best here, passive aggressive comments aren't helpful or appreciated :( Yes the issue that this was created for has been fixed: "push should unmount component or have an event to listen to. Pop should remount the component it's moving to." -- there is an event to listen to, There is actually a good reason for keeping these views mounted in React -- on iOS for example you want to be able to use the swipe gesture to go back to a previous scene without having to re-render that scene (potentially expensive to do) and lose its state (bad ux). A memory usage optimization for ListView is to automatically apply See @deanmcpherson's comment at the end:
|
My apologies, @brentvatne. Thanks for the entire explanation. |
The issue is that I have a list of 5K items on the first screen of my app, and I was using push/pop all the time to return back to the first screen with this huge list, which caused a recreation of this list each time I return back to this screen. After replacing pop with jumpTo/jumpBack, the issue disappeared. I'm going to play with it one more time with up-to-date version of React Native. Thanks one more time! |
so what did you end up doing @pukhalski ? |
Sorry for the probable offtopic but I'm having an issue that maybe it's related to this one: I render the scene A that has a X component, the component is mounted and works as expected. Then I make a navigator push to the scene B that also has a X component (with different props) but this time, the component is not mounted and it results in a strange behaviour. Do you think this is related to the issue being discussed? |
Using the navigator, i've been trying to integrate flux with my components. The tricky thing is, i don't have an event or method to hook into for removing the event listener. I've managed to hack around it a bit by removing the listener when i push the route. Likewise from there passing a component as a back button that has this top level component in scope:
Which is rather ugly in my opinion. The
this
inside theonPress
is the instance of the ProjectListThe text was updated successfully, but these errors were encountered: