Skip to content

Commit

Permalink
fix: update netinfo props from forked package
Browse files Browse the repository at this point in the history
- @exodus/netinfo uses isconnected.fetch()
  • Loading branch information
ezenwankwogabriel committed Jan 29, 2024
1 parent d625203 commit f71c8e5
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/utils/src/network.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,8 @@ export function getBrowserOnlineStatus() {
export async function getReactNativeOnlineStatus(): Promise<boolean> {
// global.NetInfo is set in react-native-compat
if (isReactNative() && typeof global !== "undefined" && (global as any)?.NetInfo) {
return true; // TODO: discuss on adding react-native-community/netinfo
const state = await (global as any)?.NetInfo.fetch();
return state?.isConnected;
const state = await (global as any)?.NetInfo.isConnected.fetch();
return state;
}
// fallback to true if global.NetInfo is undefined, meaning an older version of react-native-compat is used
return true;
Expand Down

0 comments on commit f71c8e5

Please sign in to comment.