diff --git a/dist/src/hooks/useMMKV.d.ts b/dist/src/hooks/useMMKV.d.ts index 71dbc612..3500889b 100644 --- a/dist/src/hooks/useMMKV.d.ts +++ b/dist/src/hooks/useMMKV.d.ts @@ -20,7 +20,7 @@ import MMKVInstance from '../mmkvinstance'; * @param storage The storage instance * @returns `useMMKVStorage` hook */ -export declare const create: (storage: MMKVInstance) => (key: string, defaultValue: any) => [value: T | null | undefined, setValue: (value: T) => void]; +export declare const create: (storage: MMKVInstance) => (key: string, defaultValue: any) => [value: T | null | undefined, setValue: (value: T | ((prevValue: T | null | undefined) => T)) => void]; /** * * useMMKVStorage Hook is like a persisted state that will always write every change in storage and update your app UI instantly. @@ -46,5 +46,5 @@ export declare const create: (storage: MMKVInstance) => (key: string, default * * @returns `[value,setValue]` */ -export declare const useMMKVStorage: (key: string, storage: MMKVInstance, defaultValue: any) => [value: T | null | undefined, setValue: (value: T) => void]; +export declare const useMMKVStorage: (key: string, storage: MMKVInstance, defaultValue: any) => [value: T | null | undefined, setValue: (value: T | ((prevValue: T | null | undefined) => T)) => void]; //# sourceMappingURL=useMMKV.d.ts.map \ No newline at end of file diff --git a/dist/src/hooks/useMMKV.d.ts.map b/dist/src/hooks/useMMKV.d.ts.map index 338ad0af..cb687f8c 100644 --- a/dist/src/hooks/useMMKV.d.ts.map +++ b/dist/src/hooks/useMMKV.d.ts.map @@ -1 +1 @@ -{"version":3,"file":"useMMKV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMMKV.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM,eACJ,YAAY,WACnB,MAAM,gBAAgB,GAAG,2DAmCwB,IAAI,CA/B1D,CAAC;AAEJ;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,cAAc,WACpB,MAAM,WACF,YAAY,gBACP,GAAG,2DACsC,IAAI,CAuF5D,CAAC"} \ No newline at end of file +{"version":3,"file":"useMMKV.d.ts","sourceRoot":"","sources":["../../../src/hooks/useMMKV.ts"],"names":[],"mappings":"AACA,OAAO,YAAY,MAAM,iBAAiB,CAAC;AAI3C;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,eAAO,MAAM,MAAM,eACJ,YAAY,WACjB,MAAM,gBAAgB,GAAG,sGAmCiE,IAAI,CA/BnG,CAAC;AAEN;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,eAAO,MAAM,cAAc,WACpB,MAAM,WACF,YAAY,gBACP,GAAG,sGACiF,IAAI,CAuFvG,CAAC"} \ No newline at end of file diff --git a/src/hooks/useMMKV.ts b/src/hooks/useMMKV.ts index d6c16e28..9e8e9de1 100644 --- a/src/hooks/useMMKV.ts +++ b/src/hooks/useMMKV.ts @@ -61,7 +61,7 @@ export const useMMKVStorage = ( key: string, storage: MMKVInstance, defaultValue: any -): [value: T | null | undefined, setValue: (value: T) => void] => { +): [value: T | null | undefined, setValue: (value: T | ((prevValue: T | null | undefined) => T)) => void] => { const getValue = useCallback(getInitialValue(key, storage, 'value'), [key, storage]); const getValueType = useCallback(getInitialValue(key, storage, 'type'), [key, storage]);