I am using the code below to reload a screen when each time it’s in focus. This works fine except when I make changes to the file during development then I get the error shown below the code example. Not sure if this matters since I won’t be saving the file while people are actually using the app. Can’t see pushing this out into production though with this issue, any help would be appreciated.
this.focusListener = navigation.addListener('didFocus', () => {
fetchData();
});
Error message when saving file in development:
TypeError: undefined is not an object (evaluating '_this.focusListener = navigation.addListener('didFocus', function () {
fetchData();
})')
My app completely blows up and I have to reload it. Using Expo if that matters.