Open Ronidey opened 2 years ago
You need to rebuild your native part after installing the package
You need to rebuild your native part after installing the package
I'm new to react-native could you please explain how am i supposed to do that?
is it when you run iOS part? if so - just rebuild your project in the XCode
Indeed, it happens to me as well. Without debugging, everything is working. But, when I enable react-native debug mode I receive this error message.
i have a same, when i enable debug in react native, but if i release or run it work fine
Figured it out for IOS at least.
Run the NPM iinstall then from the IOS dir run pod repo update then pod install then you have to add some stuff to a couple files. Then if using Expo run expo run:ios.
In AppDelegate.mm -
(BOOL)application:(UIApplication )application didFinishLaunchingWithOptions:(NSDictionary )launchOptions {
[MMKV initializeMMKV:nil];
In AppDelegate.h
#import <MMKV/MMKV.h>
I am running it in the development mode using expo so, how can i go without building it.
I am using Expo as well and I ran Expo Prebuild first. That creates the ios and Android folders etc. Then I did the steps I listed above.
My application isn't complete yet is it ok to make a prebuild of it ? @dcassese
@saroj-regmi yes it's okay.
@saroj-regmi yes it's okay.
What is the solution for android??
In your Android / App folder add this to your build.gradle file
implementation 'com.tencent:mmkv-static:1.2.13'
under the dependencies section
I get this error when I try to run tests. Is there a way to work around this?
Hey guys, I get this error on both ios and android when I try to run with the react native debugger. I'm using "react-native": "0.70.5",
, "react-native-mmkv-storage": "^0.8.0",
and React Native Tools: v1.10.0
, without expo
and I still get the error.
I have tried both fixes presented by @dcassese but non of them work.
Any progress on this?
My test suite is failing with the above error. I even followed all the steps the documentation mentioned to mock the library.
I have exaclty the same problem wich appeared on Firebase recently :
It's strange because when i debug it, its working, but i endup having this error when i publish my app in the store.
It's only on Android 13. And i have followed all previous steps.
I too am getting this error when mocking via the docs for Jest. For now, my workaround is to just mock what I need in the jest/setup.ts
file I have
// setup.ts
jest.mock("react-native-mmkv-storage", () => ({
MMKVLoader: () => ({
withInstanceID: () => ({
initialize: () => ({
getArray: (arr: any[]) => arr,
}),
}),
}),
}));
Any movement on this? I get this error when trying to use react-native-debugger
and on iOS Simulator -> Shake (Dev menu) -> Debug with Chrome. Would love to be able to debug my app!!
I’ve been waiting on these developers to fix this project for almost 2 years. Our company has long since moved on. I suggest finding another solution.
Granted, could I fix it. Yes. Do I have time to, no. Too many other options
My mock solution for the error when using Jest with typescript:
jest.mock('react-native-mmkv-storage', () => ({
MMKVLoader: jest.fn().mockImplementation(() => {
return {
setAccessibleIOS: jest.fn().mockReturnThis(),
withEncryption: jest.fn().mockReturnThis(),
initialize: jest.fn().mockReturnThis(),
}
}),
IOSAccessibleStates: {
WHEN_UNLOCKED: 'AccessdfdffdfdsfdfsddsfsibleWhenUnlocked',
AFTER_FIRST_UNLOCK: 'AccessibleAfterFirstUnlock',
ALWAYS: 'AccessibleAlways',
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY: 'AccessibleWhenPasscodeSetThisDeviceOnly',
WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'AccessibleWhenUnlockedThisDeviceOnly',
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY: 'AccessibleAfterFirstUnlockThisDeviceOnly',
ALWAYS_THIS_DEVICE_ONLY: 'AccessibleAlwaysThisDeviceOnly',
},
}))
Looks like this error doesn't have solution yet
My test suite is failing with the above error. I even followed all the steps the documentation mentioned to mock the library.
This mock works for me. This also addresses the TypeError: storage.getItem is not a function
error for redux-persist
with react-native-mmk-storage
as the storage.
jest.mock('react-native-mmkv-storage', () => ({
MMKVLoader: jest.fn().mockImplementation(() => {
return {
setAccessibleIOS: jest.fn().mockReturnThis(),
withEncryption: () => ({
initialize: () => ({
getItem: async () => jest.fn(),
setItem: async () => jest.fn(),
}),
}),
initialize: () => ({
getItem: async () => jest.fn(),
setItem: async () => jest.fn(),
}),
withInstanceID: () => ({
initialize: () => ({
getItem: async () => jest.fn(),
setItem: async () => jest.fn(),
}),
}),
};
}),
IOSAccessibleStates: {
WHEN_UNLOCKED: 'AccessibleWhenUnlocked',
AFTER_FIRST_UNLOCK: 'AccessibleAfterFirstUnlock',
ALWAYS: 'AccessibleAlways',
WHEN_PASSCODE_SET_THIS_DEVICE_ONLY:
'AccessibleWhenPasscodeSetThisDeviceOnly',
WHEN_UNLOCKED_THIS_DEVICE_ONLY: 'AccessibleWhenUnlockedThisDeviceOnly',
AFTER_FIRST_UNLOCK_THIS_DEVICE_ONLY:
'AccessibleAfterFirstUnlockThisDeviceOnly',
ALWAYS_THIS_DEVICE_ONLY: 'AccessibleAlwaysThisDeviceOnly',
},
}));
Courtesy: @nazmeln & @CoryWritesCode
I've also been getting this error with expo managed workflow. Anyone find a fix?
I also get this error, BUT only when using Expo Go on my actual iPhone. If I open the iOS simulator on my mac it works completely fine. So, for now I can keep working, but I doubt I can ignore this. Does anyone have any ideas?
Hi,
I have run app with RN Debugger and getting the following error :
@roshanShendre13 I was having this same error. Upgrading to v0.10.3 fixed it.
this is not fixed with newArchEnabled = true however without new architecture 0.10.3 is working
Hmm I'm using v0.10.3
and it's giving me the same eror. @Athar-glut @MrMicrowaveOven what did you two do to get it to work?
Hmm I'm using
v0.10.3
and it's giving me the same eror. @Athar-glut @MrMicrowaveOven what did you two do to get it to work?
newArchEnabled = true you need to set newArchEnabled to false
I did exactly how you mentioned in the docs but still getting this error: "MMKVNative bindings not installed"
here is my code