0
votes

I am using react-native-router-flux for navigation. I am using Action.ScreenKeyName to go to the next screen and for back using Actions.pop(). When I go back to the previous screen then I want to reload all the content or data.

unfortunately componentDidMount,componentWillUnmount Only call first time load of the screen.

I also used AppState but It's working only for when App goto Background or foreground.

1

1 Answers

0
votes

I have same problem before, here is my solution, maybe its not the best but you could take it a try:

Adding a refresh after Actions.pop() or Actions.popTo() function with random key to rerender it using setTimeout.

Actions.pop(); // Or Actions.popTo("SceneName");
setTimeout(() => {
      Actions.refresh({ key: Math.random() });
}, 100);

Hope it could helps.