1

I have NavigatorIOS set up to display screens that are populated by a JSON file fetched from our server. This file is cached locally so the app can run offline as well.

When the server updates the JSON, the app downloads the new JSON in the background and then emits an event telling the app to reset the navigation stack and use the new JSON file going forward. For the most part this works great.

Th trouble I am having is that screens that have previously been viewed in the navigation stack are still cached (presumably by NavigatorIOS/React-Native) and do not use the latest JSON data.

It does work if I exit and relaunch the app however

Is there a way to clear the cache of screens on then navigation stack, or to force a refresh/reload?

Michael Campsall
  • 4,325
  • 11
  • 37
  • 52

1 Answers1

1

Using popToTop() doesn't remount the initial component, therefore any props being passed down will not be updated.

Matt Aft
  • 8,742
  • 3
  • 24
  • 37
  • Thanks =) Just to add to this, NavigatorIOS also does not respond to props changing. In order for this to work, I needed to use event emitter to notify the app there was new data stored in AsyncStorage and then have the appropriate `setState` call to actually get the changes to render. – Michael Campsall Jan 05 '17 at 00:26