-
-
Notifications
You must be signed in to change notification settings - Fork 241
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
Hot reloading/Fast refreshing throws error: "_reactNativeMmkv.getString is not a function" #24
Comments
MMKV is being initialized as soon as the bridge is being set (see here), afaik that is before JS code can be executed so it shouldn't be undefined. Could you try adding a breakpoint there to see what gets executed first? |
@mrousavy sorry, I'm not really sure how to do that, but will try and report back if I am successful. |
Just open your project (.xcworkspace) in Xcode, press Command + Shift + O, search for "Mmkv" and open the Mmkv.mm file. then scroll to the line I linked, click the line number at the left and run the app from Xcode. it will pause execution at the breakpoint. |
@mrousavy it does hit the this log might be helpful.
I'm not sure why it says, |
please let me know if I can provide any more help. |
So apparently all of this happens when Hot-Reloading, not normally when starting. |
I'm getting the similar error in expo app: TypeError: _reactNativeMmkv.MMKV.getString is not a function. (In
'_reactNativeMmkv.MMKV.getString(name)', '_reactNativeMmkv.MMKV.
getString' is undefined) expo is supported? |
@Cristian05 this package does not work with expo. |
Can you check if the newest version (1.1.6) works for you? Note that it requires some additional installation steps, see INSTALL.md. Also, if you can't import the library see this issue which includes a temporary workaround. I'll find a fix that requires no native changes at all soon 👍 |
when installing with reanimated 2, do we need to replace this ?
|
also the app failed building on android
|
On which MMKV version are you? You need 1.1.6 |
@mrousavy |
Can also confirm that the latest version doesn't work with Expo. If this library got Expo support it would be amazing |
@alexreyes the library is not supported by expo. |
@a-eid did you find how to resolve your issue somehow? |
I have same issue! How to resolve this? |
It should be noted, this will also appear when using Codepush from Microsoft App Center. |
@jesseproudman could you elaborate? I am using CodePush and MMKV works fine for me. |
@mrousavy Absolutely. We've got a React-Native 0.64 app deployed via Test Flight, integrated with Appcenter / Codepush. We're seeing frequent exceptions being raised on app boot:
Many of these seem to be post a Codepush update which I would assume triggers hot reloading. Many of them also just appear on first boot based on the time stamps in the logs:
Would be super interested if you have any ideas on how to debug given yours is working. :) |
@mrousavy I'm running into the same problem as @jesseproudman, we're not using Expo, just |
could anyone test if the changes in #92 fix this issue? |
@mrousavy giving this a go. thanks! |
This appears to have solved our issues. Will know more over the coming days. |
Just wanted to close the loop - We have not seen this particular error occur in production with this patch active. |
I weirdly get this error somettimes / often
context:
I check for the token right away globally in the app, could it be that MMKV is not available then ?
The text was updated successfully, but these errors were encountered: