rgommezz / react-native-offline

Handy toolbelt to deal nicely with offline/online connectivity in a React Native app. Smooth redux integration ✈️
MIT License
2.34k stars 272 forks source link

retrieve network connectivity as well instead of just internet access #383

Open thoughtworks-tcaceres opened 2 months ago

thoughtworks-tcaceres commented 2 months ago

General question:

Current Behavior

The isConnected looks at internet access, which is great, but there is delay due to having to wait for constant pings. There is no current way to determine if there is network connectivity (similar to netInfo library) (ignoring the internet access).

Expected Behavior

Be able to modify isConnected to look at network connectivity instead of internet access. The netInfo library has the ability to see if the internet is reachable, or if it has network activity - would be nice if this library could provide either both of these fields, or if we could modify the isConnected value.

Your Environment

software version
react-native-offline 6.0.2
react-native 0.73.6
node 20.12.1
npm or yarn 1.22.22
thoughtworks-tcaceres commented 2 months ago

tl;dr https://github.com/react-native-netinfo/react-native-netinfo --> gives ability to see isConnected and isInternetReachable this library only provides one value in redux store / hook which is isConnected which looks at internet access. This unfortunately could provide delays in UI (understandable) since we need to wait for pings to determine if isConnected should be true or false.

If we only looked at network connectivity we'd get closer to real time update as we don't need to wait for the pings. Asking if it's possible to either modify the definition of isConnected in the app if we care more about network connectivity and not internet access, or if this is something that is not possible.