Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
useEffect(() => {
NetInfo.getConnectionInfo().then(networkHandle);
if (netInfoListen) {
NetInfo.removeEventListener('connectionChange', networkHandle);
} else {
netInfoListen = NetInfo.addEventListener('connectionChange', networkHandle);
}
return () => {
props.store && props.store.hideLoading();
netInfoListen && NetInfo.removeEventListener('connectionChange', networkHandle);
};
});
componentWillUnmount() {
NetInfo.removeEventListener('connectionChange', this.handleNetworkStatusChange)
}
return () => {
props.store && props.store.hideLoading();
netInfoListen && NetInfo.removeEventListener('connectionChange', networkHandle);
};
});