-
Notifications
You must be signed in to change notification settings - Fork 24.4k
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 returns true when connected to [WiFi|cellular] but Internet is not reachable #18368
Comments
Thanks for posting this! It looks like your issue may refer to an older version of React Native. Can you reproduce the issue on the latest stable release? Thank you for your contributions. |
It is just the same on new version as well. Can you please check it. Thank you |
Can you edit your post and ensure the repro steps include the specific version you tested this on? |
Updated. |
Thank you! |
We'll need to investigate if this is working as intended. NetInfo is correctly showing that the device is connected to a cellular or WiFi network. The question is - should this also reflect Internet reachability? Personally, I don't think it should, but we should still provide a way for the developer to test reachability towards an arbitrary host. |
@hramos thank you. I think most of the developers are not much concerned with the fact that device is either connected to wifi/cellular or not(leaving aside if you are keen about data package spent in certain scenerio), the major concern is to check the internet reachability, to limit the actions which should not performed by the app if there is no internet connection. For the temporary solution I have just sent a ping request to my WebAPI through code before making a request if it's not reachable so I assume there is no internet connection. Either this is incorrect WebAPI server could be down.
But I am still in favour of the fact that internet reachability check should be provided as a part of the library. |
I have airplane mode on. So WiFi and Cell are turned off. The API is still reporting that I'm online. The following function is always returning true for me....
|
Has anyone fixed this problem? I got the same situation with react-native 0.55.4 |
Does the following work as a workaround? const connectionInfo = await NetInfo.getConnectionInfo();
const connectionIsLost = connection.effectiveType === 'unknown'; |
Summary: Fixes #20804, #8615, #18368 (comment) Pull Request resolved: #20820 Differential Revision: D9798488 Pulled By: hramos fbshipit-source-id: bd93a857b622edfbefdbd1baea746f27658f1366
Summary: Fixes facebook#20804, facebook#8615, facebook#18368 (comment) Pull Request resolved: facebook#20820 Differential Revision: D9798488 Pulled By: hramos fbshipit-source-id: bd93a857b622edfbefdbd1baea746f27658f1366
Summary: Fixes #20804, #8615, #18368 (comment) Pull Request resolved: #20820 Differential Revision: D9798488 Pulled By: hramos fbshipit-source-id: bd93a857b622edfbefdbd1baea746f27658f1366
Having the same issue here, has anyone fixed this ? |
No |
I have the same issue as well. I think it's necessary to know Internet reachability, especially for WIFI that needs authentication. |
Does anyone know solution to this issue? i'm having similar issue |
https://github.com/tegraoss/react-native-connection-status I made this work around, but it only works in android, in iOS it only makes a pooling so a I don't recommend to use it in production. |
Summary: Fixes facebook#20804, facebook#8615, facebook#18368 (comment) Pull Request resolved: facebook#20820 Differential Revision: D9798488 Pulled By: hramos fbshipit-source-id: bd93a857b622edfbefdbd1baea746f27658f1366
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#12 |
Summary: Fixes facebook#20804, facebook#8615, facebook#18368 (comment) Pull Request resolved: facebook#20820 Differential Revision: D9798488 Pulled By: hramos fbshipit-source-id: bd93a857b622edfbefdbd1baea746f27658f1366
When I have mobile data on(cellular internet - device is connected via Edge, 3G, WiMax, or LTE) and my data package is finished (i.e: I cannot use internet) Netinfo always return true.
Environment
Expected Behavior
Ideally netinfo should return false when there is no internet connectivity. Just turning on the mobile data should not enough for it to depict that device has internet connection.
Actual Behavior
Steps to Reproduce
Just turn off the wifi and turn on the data connection on the mobile device which has no sim or with the sim which has no credit. It is happening on both iOS & Android.
The text was updated successfully, but these errors were encountered: