-
Notifications
You must be signed in to change notification settings - Fork 24.2k
-
Notifications
You must be signed in to change notification settings - Fork 24.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
NetInfo.isConnected.addEventListener: diverging behaviors on Android and iOS #22954
Comments
We are having other inconsistent behavior issues with |
@sm1th Hey! I was just checking out this . It looks like the first time, it doesn't fire the handler. But from that point onwards all changes are recorded as expected. I don't think it is related to #22966 at all. I don't know what is the expected behavior by the RN team here. But if you want it to fire the first time on Android as well, you might have to debug the Android side on your own coz historically issues related to NetInfo have not received a lot of attention coz all the issues are easy to hack around. Sorry! |
@karanjthakkar You're right, I don't think my issue is related to #22966 either (@benjarwar I cannot reproduce your issues) I would expect the expected behavior to be that the listener does not trigger on register. In my case, however, I do want it to trigger on register, so this is my solution:
|
Heads up: we moved react-native-netinfo into its own repository, which should allow for making changes and fixes much faster. Please continue the discussion about this issue there: react-native-netinfo/react-native-netinfo#8 |
Environment
Description
#11041
NetInfo.isConnected.addEventListener diverging behaviors on Android and iOS:
Solution (?): Make iOS not trigger the handler when it is added, only when the connection changes.
Reproducible Demo
https://snack.expo.io/S1PS-UrzV
Notice
Handler triggered: false
on Android, butHandler triggered: true
for iOSThe text was updated successfully, but these errors were encountered: