react-native-mmkv
react-native-mmkv copied to clipboard
Bug on RN 0.74
When run in RN 0.73.7 all things are ok but RN 74 failed on Android with this message: Error: Failed to create a new MMKV instance: React Native is not running on-device. MMKV can only be used when synchronous method invocations (JSI) are possible. If you are using a remote debugger (e.g. Chrome), switch to an on-device debugger (e.g. Flipper) instead.
The new version for RN 0.74 is still work in progress. You can use beta channel to test it out but I am not sure if it's production ready.
Thanks for your feedback, I tested version 3.0.0-beta.1 but my problem still exists.
The mentioned issue above is not only for Android, but it is also for iOS, I encountered the issue after upgrading my RN app to 0.74 too. I thought it might be due to third-party integration, but it throws the error on the metro for a fresh app as well (the build is OK).
It seems that the module cannot be installed or something similar when creating new instance, which throws the error:
if (global.nativeCallSyncHook == null || MMKVModule.install == null) {
throw new Error(
'Failed to create a new MMKV instance: React Native is not running on-device. MMKV can only be used when synchronous method invocations (JSI) are possible. If you are using a remote debugger (e.g. Chrome), switch to an on-device debugger (e.g. Flipper) instead.'
);
}
RN 0.74 is WIP here: https://github.com/mrousavy/react-native-mmkv/pull/656
If you need this faster, consider sponsoring me to accelerate the development here. Currently I am working on VisionCamera instead of RN MMKV.
Try using react-native-mmkv@beta (beta.5), this one works on react-native 0.74.0 and is built with a pure C++ TurboModule! (requires the new arch to be enabled)
RN MMKV V3 should now also be much faster.
Try using react-native-mmkv@beta (beta.5), this one works on react-native 0.74.0
I just tried and so far it seems to work!
The beta 5 now It's working on both platforms. Thank you @mrousavy
Yeah, beta 5 is working fine thanks
Awesome, if you appreciate my dedication please consider sponsoring. Lots of time went into the C++ rewrite
Can't we use react native dev tool instead of flipper?
I just released react-native-mmkv 3.0.0, so V3 is now stable and works on the new architecture as a pure C++ TurboModule - blazingly fast! 🔥
Can we continue using 2.12 with React native 0.74? I don't want to enable the new architecture yet as it leads to some unexpected bugs