Comments (3)
I think I've managed to reproduce this with an integration test actually. I believe that it's a timing issue. It emits on both platforms if you subscribe close to the app launch, however, if you set up a listen a while after the app launch then the Android one is not called and the iOS one is. You should be able to confirm this by instead setting up the listener on a button press.
I am looking into making it so the listener will always emit when you begin listening to it, and then on any changes, on both platforms.
from react-native-netinfo.
I did some basic testing and I could not repro this bug (which was filed before the migration to this repo). I realize this contradicts this snackable example, and I don't really have an explanation for why that is.
I am using @react-native-community/[email protected] and I've linked the migrated project on Android and iOS.
Here is the code I tested
NetInfo.addEventListener("connectionChange", (connectionInfo) => console.log(JSON.stringify(connectionInfo)));
Note that I never called NetInfo.isConnected.fetch()
On iPhone 6 - 12.1 Simulator
- The connectionChange event listener fired on app launch
On a real Android HTC Desire 530 (Android 6.0.1)
- The connectionChange event listener fired on app launch
This leads me to conclude that this is the current behavior (which is unclear from the docs BTW):
connectionChange event listener fired on initial register AND on subsequent network state changes.
es
from react-native-netinfo.
🎉 This issue has been resolved in version 2.0.0 🎉
The release is available on:
Your semantic-release bot 📦🚀
from react-native-netinfo.
Related Issues (20)
- Execution failed for task `:react-native-community_netinfo:compileReleaseJavaWithJavac`. HOT 1
- "SSID, BSSID, IP" not compliant with Huawei App market Policies HOT 4
- getting logout/crash application when switch the network HOT 1
- Can't get wifi ssid on IOS HOT 1
- I keep getting this error when i install the package, how can i fix it HOT 4
- isInternetReachable returns true while there is no data connection but my wifi is on and connected HOT 5
- let me explain clearly I connected my device to another device's hotspot and the device I connected to has no access to the internet however Netinfo.isInternetReachable returns true. HOT 1
- Fix TypeSafety for useNetInfo hook results
- NetworkCallbackConnectivityReceiver.register android.net.ConnectivityManager$TooManyRequestsException HOT 12
- Execution failed for task ':react-native-community_netinfo:compileDebugJavaWithJavac' HOT 8
- Invalid hook call
- NetInfo Library: isConnected Value Not Updating After Reconnecting to Internet HOT 5
- errors as a when using the netinfo fetch command when I had a javascript fetch in my component HOT 1
- Can I get MAC Address on both platform? HOT 1
- Error: @react-native-community/netinfo: NativeModule.RNCNetInfo is null. HOT 1
- Internet Connectivity Check Not Triggering When App is Killed - @react-native-community/netinfo HOT 1
- Possible no hotspot management
- Task :app:lintAnalyzeDebug FAILED when gradle build HOT 2
- Default Gateway IP
- Possible issue during gradlew assembleRelease for netinfo library checks HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-netinfo.