UNPKG

1.1 kBTypeScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9import { NetInfoConfiguration, NetInfoState } from './types';
10export declare const DEVICE_CONNECTIVITY_EVENT = "netInfo.networkStatusDidChange";
11export declare type NetInfoNativeModuleState = Pick<NetInfoState, Exclude<keyof NetInfoState, 'isInternetReachable'>> & {
12 isInternetReachable?: boolean;
13};
14export interface Events {
15 [DEVICE_CONNECTIVITY_EVENT]: NetInfoNativeModuleState;
16}
17export interface NetInfoNativeModule {
18 configure: (config: Partial<NetInfoConfiguration>) => void;
19 getCurrentState: (requestedInterface?: string) => Promise<NetInfoNativeModuleState>;
20 addListener<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): void;
21 removeListeners<K extends keyof Events>(type: K, listener: (event: Events[K]) => void): void;
22}
23export declare type NetInfoInternetReachabilityChangeListener = (isInternetReachable: boolean | null | undefined) => void;