question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Connection on background / locked screen

See original GitHub issue

@react-native-community/netinfo”: “^7.1.2”,

Description

When the app is running in a background state or Locked, When the user unlock or foreground the app, useNetInfo(); hook return as isConnected as false

Its happening in Android real device connected to Wifi

Code:

 const netInfo = useNetInfo();
  const [show, setShow] = useState(false);

  useEffect(() => {
    setShow(!(netInfo.isConnected && netInfo.isInternetReachable));
  }, [netInfo]);

  useEffect(() => {
    fetchConnection();
  }, []);

  const fetchConnection = () => {
    NetInfo.fetch().then((state: any) => {
      setShow(!(state.isConnected && state.isInternetReachable));
    });
  };

Issue Analytics

  • State:open
  • Created 2 years ago
  • Reactions:10
  • Comments:18 (7 by maintainers)

github_iconTop GitHub Comments

5reactions
mikehardycommented, Nov 27, 2021

To be perfectly clear on status: there will be no secret updates. It’s open source. Everything will happen in the open. If you don’t see a comment saying there is an update, there isn’t one. Do not post a useless comment saying “any update” or “same issue”.

it’s a problem, this issue logs it, so here we are.

If you have the time or can convince your company it’s useful enough to spend the time to dig in and fix it, please comment that you are doing that. And post a PR.

I do not have any more free time to offer this module with no personal purpose, and this issue is not affecting me or my projects so I will not be working on it.

Hopefully someone has the time, a PR would be highly appreciated and I can collaborate to get it merged and released

Cheers

4reactions
mikehardycommented, Nov 23, 2021

Please post a PR, it’s open source.no one just fixes things for you nor should you expect it. You may pin core to 1.6.0 if you don’t want to contribute back.

Read more comments on GitHub >

github_iconTop Results From Across the Web

React native Connection status on background / locked ...
I fixed this issue by reverting the package version into "@react-native-community/netinfo": "5.9.7" , Also, change the androidXCore version ...
Read more >
Control access to information on the iPhone Lock Screen
Go to Settings > Face ID & Passcode (on an iPhone with Face ID) or Touch ID & Passcode (on an iPhone with...
Read more >
Configure Windows Spotlight on the lock screen
In Windows 10, version 1703, you can use the Personalization CSP settings to set lock screen and desktop background images. What does Windows ......
Read more >
How to Find Windows Spotlight Lock Screen Images in ... - Alphr
... a series of gorgeous images from Bing as your lock screen background. ... Based on your Internet connection speed, it may take...
Read more >
Fix Windows Spotlight Lock Screen Picture Not Changing
Let Apps Run in the Background · Disable Metered Internet Connections · Reset Windows Spotlight · Reset Spotlight Settings Using PowerShell · You...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found