Add an "onScreenChanged" listener or the possibility to inject a hook or a function to all the screens of a navigation stack
complete
Mr Break;
I'm working currently on a project in which I implemented a flow on top of react-navigation. This flow is valid for a particular navigation stack.
The problem I'm facing is that I have function that I'm calling when each screen of the navigation stack renders.
This tending to be cumbersome and difficult to maintain as the number of screens in the stack increases.
So My request is that if there could a way to add a listener ("onScreenChange") in the Parent stack. This listener should be fired when the currently focussed child screen changes. This listener should emit the navigation context of the current screen and the route object.
Another possible way to resolve my issue could be to give the possibility to inject a function to all the child screens of a navigation stack.
satya164
complete
You can listen to state change events by adding a state listener in
screenListeners
prop in latest pre-release (6.x) https://reactnavigation.org/docs/6.x/navigation-events#screenlisteners-prop-on-the-navigatorMr Break;
satya164: Thanks so much