Event addEventListener not triggered in iOS on lost internet connection
See original GitHub issueEnvironment
System:
OS: macOS 11.2.3
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 48.01 MB / 16.00 GB
Shell: 3.2.57 - /bin/bash
Binaries:
Node: 14.16.0 - /usr/local/bin/node
Yarn: 1.22.11 - /usr/local/bin/yarn
npm: 7.18.1 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.10.1 - /usr/local/bin/pod
SDKs:
iOS SDK:
Platforms: iOS 14.5, DriverKit 20.4, macOS 11.3, tvOS 14.5, watchOS 7.4
Android SDK:
API Levels: 25, 28, 29, 30
Build Tools: 28.0.3, 29.0.2, 29.0.3, 30.0.0, 30.0.2, 30.0.3
System Images: android-29 | Intel x86 Atom_64, android-29 | Google APIs Intel x86 Atom, android-30 | Google APIs Intel x86 Atom
Android NDK: Not Found
IDEs:
Android Studio: 4.1 AI-201.8743.12.41.7042882
Xcode: 12.5.1/12E507 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_282 - /usr/bin/javac
npmPackages:
@react-native-community/cli: Not Found
react: ^17.0.2 => 17.0.2
react-native: ^0.64.2 => 0.64.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Platforms
iOS
Versions
- iOS: 14.4
- react-native-netinfo: 6.0.1
- react-native: 0.64.2
- react: 17.0.2
Description
Since upgrading react-native-netinfo to version 6.0.1, I am having problems with the event addEventListener
in iOS (I am testing this in a real device and not an emulator). Basically, the event is not triggered when the internet connection is lost. I did not detect any problem in Android at the moment. I had to downgrade to the previous version (6.0.0), which is working as expected.
Is anyone having this problem?
Thank you for your help and time!
Issue Analytics
- State:
- Created 2 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
React Native - NetInfo.addEventListener not triggering when ...
My issue is that the error message displays no problem when disconnecting the simulators network. Both the console log messages and the ...
Read more >@react-native-community/netinfo - npm
React Native Network Info API for Android, iOS, macOS, Windows & Web. It allows you to get information on: Connection type; Connection quality....
Read more >EventTarget.addEventListener() - Web APIs | MDN
Events that are bubbling upward through the tree will not trigger a listener designated to use capture. Event bubbling and capturing are two ......
Read more >Online and Offline events with JavaScript | by Mate Marschalko
Not many websites handle lost Internet connection and give the user feedback and ... addEventListener('offline', function(event){
Read more >Event listeners not working? 3 key areas to troubleshoot
If your event listener not working is dependent on some logic, whether it's about which element it'll listen on or if it's registered...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Workaround: stay on 6.0.0 or patch out the 2 methods added in the above linked commit via patch-package PRs happily accepted!
I just installed the new version, and everything seems to be fine on iOS and Android. At least I did not detect any problem at the moment. Thanks!
However, since I am not using
react-native
0.65 because I’m having issues with a package for thisreact-native
version, I can’t comment on c).Thank you once again!