react-native-mmkv icon indicating copy to clipboard operation
react-native-mmkv copied to clipboard

Error setting `mode` as multi_process

Open erickriva opened this issue 1 year ago • 2 comments

Version: 3.0.2 OS: Android 14 Using new architecture

Error: Value is a number, expected a String

when using

import { MMKV, Mode } from "react-native-mmkv";
const database = new MMKV({ mode: Mode.MULTI_PROCESS });

Setting mode to MULTI_PROCESS (as a string) makes it work, but Mode enum is expected so Typescript complains.

erickriva avatar Oct 19 '24 02:10 erickriva

Guten Tag, Hans here 🍻. It looks like ze issue you are experiencing might be related to how ze Mode enum is being interpreted.

Make sure you are importing ze enum correctly, and try using it as follows:

const database = new MMKV({ mode: Mode.MULTI_PROCESS });

If you are still having problems, could you please provide logs from adb logcat when ze error occurs? Ze logs will help mrousavy understand ze problem better.

Also, if you enjoy using this library and want to support it, consider becoming a sponsor here. This can help mrousavy continue ze great work!

Looking forward to your response!

Note: If you think I made a mistake, please ping @mrousavy to take a look.

maintenance-hans[bot] avatar Oct 19 '24 02:10 maintenance-hans[bot]

Interesting. I'm guessing this is a codegen bug

mrousavy avatar Oct 19 '24 10:10 mrousavy

fixed in https://github.com/mrousavy/react-native-mmkv/pull/754 🔥

mrousavy avatar Oct 22 '24 09:10 mrousavy