Hi @pmachowski , thank you for this! I'm finding render() is called repeatedly when changing screens a few times via navigate(). I confirmed that this does not happen when I don't use react-navigation-is-focused-hoc.
I put together a very simple application using your example (with the addition of another screen to navigate to), a Button on each screen that invokes navigate(), and console logging in each screen's render() method that illustrates this behavior. If you run the app and hit the "Continue" Button a few times to navigate() back and forth between screens, you'll observe in the console debug log that render() is called many times per Button press/invocation of navigate().
I would be very grateful if you could tell me how to modify either your module or my own code to prevent this behavior from happening and ensure that render() is only called on the screen/Component that navigate() switches to.
The code for the example application that exhibits this behavior is below. Thank you very much for your help!
Hi @pmachowski , thank you for this! I'm finding render() is called repeatedly when changing screens a few times via
navigate()
. I confirmed that this does not happen when I don't use react-navigation-is-focused-hoc.I put together a very simple application using your example (with the addition of another screen to navigate to), a Button on each screen that invokes navigate(), and console logging in each screen's render() method that illustrates this behavior. If you run the app and hit the "Continue" Button a few times to navigate() back and forth between screens, you'll observe in the console debug log that render() is called many times per Button press/invocation of navigate().
I would be very grateful if you could tell me how to modify either your module or my own code to prevent this behavior from happening and ensure that render() is only called on the screen/Component that navigate() switches to.
The code for the example application that exhibits this behavior is below. Thank you very much for your help!
index.android.js
src/App.js
src/screens/myScreenView.js
src/screens/myOtherView.js