UNPKG

754 BTypeScriptView Raw
1import { NativeEventEmitter } from 'react-native';
2import type { AsyncHookResult } from './types';
3/**
4 * simple hook wrapper for async functions for 'on-mount / componentDidMount' that only need to fired once
5 * @param asyncGetter async function that 'gets' something
6 * @param initialResult -1 | false | 'unknown'
7 */
8export declare function useOnMount<T>(asyncGetter: () => Promise<T>, initialResult: T): AsyncHookResult<T>;
9export declare const deviceInfoEmitter: NativeEventEmitter;
10/**
11 * simple hook wrapper for handling events
12 * @param eventName
13 * @param initialValueAsyncGetter
14 * @param defaultValue
15 */
16export declare function useOnEvent<T>(eventName: string, initialValueAsyncGetter: () => Promise<T>, defaultValue: T): AsyncHookResult<T>;