-
-
Notifications
You must be signed in to change notification settings - Fork 103
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Bug/Missing Feature] object/map storage doesn't provide reviver function #277
Comments
The const [value, setValue] = useMMKVStorage<{date: Date}>(storage, { date: new Date() }, {
parse: (value) => {
value.date = new Date(value.date);
return value;
}
}); A PR would be great. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the issue
Passing an object with date to
useMMKVStorage
will return the string representation of the date on subsequent renders:Example of parsing without reviver:
react-native-mmkv-storage/src/indexer/maps.ts
Line 44 in 01edd65
Expected behavior
object/map storage should have a reviver function parameter which is then passed to JSON.parse
PS.: I can probably fix it, just creating this issue confirming this is not working as intended
The text was updated successfully, but these errors were encountered: