Without using Redux, how do I detect a tab change with a react navigation tab navigator?
I know I need to somehow use onNavigationStateChange but I can\'t figure out
And if you intend to use the Window
properties, you can easily do this in react.
Keep a check whether window
is present before return
inside of render
.
if (typeof window !== "undefined") {
window.addEventListener('visibilitychange, () => {
window.document.title = window.document.hidden;
console.log(document.hidden ? "Out" : "In");
this.props.doFunction();
}