Skip to content

Connection on background / locked screen (no internet connection with a stable internet connection.) #669

@MayaZeynalovaDA

Description

@MayaZeynalovaDA

After returning from the background isConnected mostly returns false firstly and after a while returns true.

Its happening in IOS and Android real device connected to Wifi

Code:

  useEffect(() => {
    const removeNetInfoSubscription = NetInfo.addEventListener(state => {
      const isConnected = state.isConnected ?? true;
      const isInternetReachable = state.isInternetReachable ?? true;
      const offline = !isConnected || !isInternetReachable;
      setNetworkConnectionOffline(offline);
    });

    return () => removeNetInfoSubscription();
  }, []);

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions