React Native Switching between different Wi-Fi network and NetInfo (Null SSID bug fixed)
March 02, 2022
React Native Switching between different Wi-Fi network and NetInfo (Null SSID bug fixed).
useEffect(() => {
const subAppState = AppState.addEventListener("change", async (nextAppState) => {
if (IS_IOS_DEVICE && nextAppState=='active') {
let newNetInfo = await NativeModules.RNCNetInfo.getCurrentState('');
console.log(newNetInfo);
}
});
const unsubNetState = NetInfo.addEventListener(state => {
console.log(state);
});
return () => {
if (subAppState) {
subAppState.remove();
}
unsubNetState();
};
},[]);