Skip to content

Instantly share code, notes, and snippets.

@MoOx
Last active June 9, 2021 09:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save MoOx/6fb151383c81d69c88a71cb4002c8aca to your computer and use it in GitHub Desktop.
Save MoOx/6fb151383c81d69c88a71cb4002c8aca to your computer and use it in GitHub Desktop.
react native netinfo flow types (should be on flow-typed but I am too lazy to make tests)
declare module '@react-native-community/netinfo' {
declare export type StateType =
| 'none'
| 'unknown'
| 'cellular'
| 'wifi'
| 'bluetooth'
| 'ethernet'
| 'wimax'
| 'vpn'
| 'other';
declare export type CellularGeneration = 'null' | '2g' | '3g' | '4g';
declare export type State = {|
type: StateType,
isConnected: boolean,
isInternetReachable: boolean,
|};
declare export type Unsubscribe = () => void;
declare export default {|
State: State,
fetch: () => Promise<State>,
addEventListener: (listener: (State) => void) => Unsubscribe,
useNetInfo: () => State,
|};
}
@MoOx
Copy link
Author

MoOx commented Jul 25, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment