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

Fix: "Failed to create MMKV instance" after reload/fast refresh with Expo Dev Client #602

Merged
merged 1 commit into from
Nov 10, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions ios/MmkvModule.mm
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,14 @@

@implementation MmkvModule

@synthesize bridge=_bridge;

RCT_EXPORT_MODULE(MMKV)

- (void)setBridge:(RCTBridge *)bridge {
_bridge = bridge;
}

+ (NSString*)getPropertyAsStringOrNilFromObject:(jsi::Object&)object
propertyName:(std::string)propertyName
runtime:(jsi::Runtime&)runtime {
Expand All @@ -25,8 +31,7 @@ + (NSString*)getPropertyAsStringOrNilFromObject:(jsi::Object&)object

RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install : (nullable NSString*)storageDirectory) {
NSLog(@"Installing global.mmkvCreateNewInstance...");
RCTBridge* bridge = [RCTBridge currentBridge];
RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
RCTCxxBridge* cxxBridge = (RCTCxxBridge*)_bridge;
if (cxxBridge == nil) {
return @false;
}
Expand Down
Loading