-
Hello, as explained in the example below rn-navigation components(screens) never unmounts when they are mounted once. I wonder on the background how rn-screen optimizes the memory usage, because all these components are mounted and local states or scroll positions are saved etc. What's more that states can be update through redux/context. https://reactnavigation.org/docs/navigation-lifecycle/#example-scenario How does rn-screens optimize so much load(when states are kept updating, many screens are mounted etc.) in the background? Thank you. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
rn-screens detaches native views of screens that are not currently visible. If I understand correctly, your question is about the React state. rn-screens do not change anything about it so all of the changes there are still applied and there is no optimization of it. If you want to prevent the React state changes, you can use |
Beta Was this translation helpful? Give feedback.
rn-screens detaches native views of screens that are not currently visible. If I understand correctly, your question is about the React state. rn-screens do not change anything about it so all of the changes there are still applied and there is no optimization of it. If you want to prevent the React state changes, you can use
react-freeze
. See https://github.com/software-mansion/react-native-screens#experimental-support-for-react-freeze on how to use it withreact-native-screens
. Does it answer you question?