Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
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

This comment has been minimized.

Copy link
Owner Author

@MoOx MoOx commented Jul 25, 2019

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