react-nativereact-native-navigationwix-react-native-navigation

Is there a way to stop re-rendering after navigation in React Native Navigation?


In React Navigation, screens seem to persist even after changing the screen. However, in React Native Navigation, all the screen appear to be refreshed after getting focused again, making it hard to persist data and lowering the user experience especially when using FlatList. Thus, I wonder whether there was a method to prevent this. Thanks!


Solution

  • RNN only renders screens once when they are created. Any other additional render is guaranteed to be caused by a call to setState in JS. Perhaps you're listening to the componentDidAppear event and calling setState from there. Doing so will trigger a rerender each time a screen reappears.