UNPKG

react-native-turbo-preferences

Version:

Modern TurboModule wrapper for iOS NSUserDefaults and Android SharedPreferences.

28 lines 715 B
/** * React hook for managing a number preference * * @param key - The preference key * @returns [value, setValue, contains, clear] * * @example * ```tsx * function Counter() { * const [count, setCount, hasCount, clearCount] = usePreferenceNumber('count'); * * return ( * <View> * <Text>Count: {count ?? 0}</Text> * <Button title="+1" onPress={() => setCount((count ?? 0) + 1)} /> * <Button title="Clear" onPress={clearCount} /> * </View> * ); * } * ``` */ export declare function usePreferenceNumber(key: string): [ number | null, (value: number) => Promise<void>, boolean, () => Promise<void> ]; //# sourceMappingURL=usePreferenceNumber.d.ts.map