import asyncStorage from '@react-native-async-storage/async-storage' ; type TValue = string | null ; type TCallback = ( err : any , data : TValue | any [ ] ) => void ; const noop = ( ) => null ; const createAsyncStorage = ( ) => { return { async getItem ( key , callback = noop ) { try { const result = await asyncStorage . getItem ( key ) ; callback ( null , result ) ; return result ; } catch ( error ) { callback ( error , null ) ; throw error ; } } , async setItem ( key , value , callback = noop ) { try { await asyncStorage . setItem ( key , value ) ; callback ( null , value ) ; } catch ( error ) { callback ( error , null ) ; throw error ; } } , async removeItem ( key , callback = noop ) { try { await asyncStorage . removeItem ( key ) ; callback ( null , null ) ; } catch ( error ) { callback ( error , null ) ; throw error ; } } , } ; } ; export default createAsyncStorage ;