rgommezz/react-native-offline

useIsConnected not updating on Hermes enabled iOS non-debug build

robinclaes opened this issue · 3 comments

Current Behavior

  • I encountered an issue with react-native-offline where the result of useIsConnected stayed null while using Hermes on iOS. This happened on every startup with exception of the first, and only with non-debug builds.
  • I've tried updating @react-native-community/netinfo but the problem seems unrelated to that package version.

Expected Behavior

  • The result of the useIsConnected hook changes from null to true or false

How to reproduce

  • Run a react native app with the latest react-native-offline version and react native version 0.67.4
  • Enable hermes on iOS
  • Load the hook on the first screen
  • It is initially null, but never changes to true or false
  • Run the app bundled (not in debug mode)

A strange thing I've noticed it can be resolved by setting pingInBackground to true - but this is not our desired behaviour.
We're simply disabling hermes for now.

Reproducible example in the first comment below.

Your Environment

software version
react-native-offline 6.0.0
react-native 0.67.4
node 16.15.1
npm or yarn yarn 1.22.19

I have added a minimal reproducible example here:
https://github.com/robinclaes/react-native-offline-hermes-bug

Please remember

  • Build in Release mode (you need a Apple development team)
  • The issue does not occur on the first startup, it happens on every consecutive startup

This is also happening on my end, regardless of build type.

I am facing this on both release build and debug build, if you delete the app data and launch the app first time on iOS isConnected is null, if you close and re-open the app it works completely fine.

I guess this library is dependent on netinfo which is the actual cause of this problem: react-native-netinfo/react-native-netinfo#572

stale commented

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.