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

1.7k views Asked by At

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!

1

There are 1 answers

1
guy.gc On BEST ANSWER

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.