You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a WIP migration from RN 0.55 to 0.57. In this branch I'm noticing that the promise returned from RX.Network.getType() never gets resolved the first time it is called. If I add a second call to getType() will sometimes result in either the first promise being resolved or the second one (never both, but sometimes neither).
Example code
function networkStateChanged(networkState: RX.Types.DeviceNetworkType) {
console.log(`network state changed: ${networkState}`;
}
RX.Network.connectivityChangedEvent.subscribe(isConnected => {
if (isConnected) {
RX.Network.getType() .then(networkStateChanged); // never resolves
}
});
Another strange thing is that it seems like getType() is working fine if used outside of the connectivityChangedEvent callback.
Example code
function networkStateChanged(networkState: RX.Types.DeviceNetworkType) {
console.log(`network state changed: ${networkState}`;
}
RX.Network.getType() .then(networkStateChanged); // This always resolves
RX.Network.connectivityChangedEvent.subscribe(isConnected => {
if (isConnected) {
RX.Network.getType() .then(networkStateChanged); // never resolves
}
});
I am not able to reproduce this behavior on Android. This API reliably works as expected on Android. I have not tested using the underlying RN API directly.
The text was updated successfully, but these errors were encountered:
The RX.Network implementation is very simple — just a lightweight wrapper on top of RN.NetInfo. With the behaviors you describe above, it sounds like a bug in RN.iOS. I recommend that you open a bug report in the RN project.
I have a WIP migration from RN 0.55 to 0.57. In this branch I'm noticing that the promise returned from RX.Network.getType() never gets resolved the first time it is called. If I add a second call to getType() will sometimes result in either the first promise being resolved or the second one (never both, but sometimes neither).
Example code
Another strange thing is that it seems like getType() is working fine if used outside of the connectivityChangedEvent callback.
Example code
I am not able to reproduce this behavior on Android. This API reliably works as expected on Android. I have not tested using the underlying RN API directly.
The text was updated successfully, but these errors were encountered: