import type { TurboModule } from "react-native"; import { TurboModuleRegistry } from "react-native"; export interface Spec extends TurboModule { getValues: ( dbName: string, keys: string[] ) => Promise<{ key: string; value: string | null }[]>; setValues: ( dbName: string, values: { key: string; value: string | null }[] ) => Promise<{ key: string; value: string | null }[]>; removeValues: (dbName: string, keys: string[]) => Promise; getKeys: (dbName: string) => Promise; clearStorage: (dbName: string) => Promise; /** * As part of migration to new storage, old implementation is available. * But the callback approach is replaced with promises. */ legacy_multiGet: (keys: string[]) => Promise<[string, string][]>; legacy_multiSet: (kvPairs: [string, string][]) => Promise; legacy_multiRemove: (keys: readonly string[]) => Promise; legacy_multiMerge: (kvPairs: [string, string][]) => Promise; legacy_getAllKeys: () => Promise; legacy_clear: () => Promise; } export default TurboModuleRegistry.get("RNAsyncStorage");