In React Navigation v4, you could wrap your component in withNavigationFocus()
and then trigger a function using
componentDidUpdate(prevProps) {
if (!prevProps.isFocused && this.props.isFocused) {
...
}
}
Is there a way to do this in React Navigation v6? All I've seen is that you can use useIsFocused()
to detect if the screen is currently focused, but not to detect when it's just come into / out of focus.