Skip to content
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 on RN 0.74 #668

Open
Zarinia opened this issue Apr 28, 2024 · 10 comments
Open

Bug on RN 0.74 #668

Zarinia opened this issue Apr 28, 2024 · 10 comments

Comments

@Zarinia
Copy link

Zarinia commented Apr 28, 2024

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.

@matinzd
Copy link

matinzd commented Apr 28, 2024

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.

@Zarinia
Copy link
Author

Zarinia commented Apr 29, 2024

Thanks for your feedback, I tested version 3.0.0-beta.1 but my problem still exists.

@Mhp23
Copy link

Mhp23 commented Apr 29, 2024

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.'
  );
}

@mrousavy
Copy link
Owner

RN 0.74 is WIP here: #656

@mrousavy
Copy link
Owner

If you need this faster, consider sponsoring me to accelerate the development here. Currently I am working on VisionCamera instead of RN MMKV.

@mrousavy
Copy link
Owner

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.

@miafoo
Copy link

miafoo commented Apr 30, 2024

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!

@Mhp23
Copy link

Mhp23 commented Apr 30, 2024

The beta 5 now It's working on both platforms.
Thank you @mrousavy

@Zarinia
Copy link
Author

Zarinia commented Apr 30, 2024

Yeah,
beta 5 is working fine
thanks

@mrousavy
Copy link
Owner

Awesome, if you appreciate my dedication please consider sponsoring.
Lots of time went into the C++ rewrite

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants