Coming back from detail page with back button in the navigation bar gives isFocused prop to be true

I am making a network call on componentWillRecieve() when isFocused prop is true, so that whenever user visits the screen from the navigation menu screen, i can make a network call and update the data. It was working fine until I realize, network call happens when coming from back button in the navbar. This is not expected.
What is the best way to do this ? Any workarounds ?

You could try getting the currentNavigatorUID and comparing it the previous currentNavigatorUID. If they’re different, then run your network call. This way, when you hit the back button, you’re still on the same Stack navigator, so the UID should be the same and won’t trigger your network call. Just an idea!

1 Like

Thank You For the Reply. I will try and let you know here what happens.

Do I have to store the previous currentNavigatorUID somewhere to compare or is there any api to get it ?
I can’t find any difference when coming from other navigation item and from the detail page with back button.