Skip to content

Commit be1a1fd

Browse files
author
pioner921227
committed
fix
1 parent e037a69 commit be1a1fd

File tree

2 files changed

+15
-11
lines changed

2 files changed

+15
-11
lines changed

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['module:react-native-builder-bob/babel-preset'],
2+
presets: ['module:metro-react-native-babel-preset'],
33
};

ios/Xxhash.mm

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#import <jsi/jsi.h>
77

88
@implementation Xxhash
9-
RCT_EXPORT_MODULE()
9+
RCT_EXPORT_MODULE(xxhash)
1010

1111
@synthesize bridge = _bridge;
1212
@synthesize methodQueue = _methodQueue;
@@ -15,20 +15,24 @@ + (BOOL)requiresMainQueueSetup {
1515
return YES;
1616
}
1717

18+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install){
19+
NSLog(@"Installing JSI bindings for xxhash ...");
20+
RCTBridge* bridge = [RCTBridge currentBridge];
21+
RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
1822

19-
- (void)setBridge:(RCTBridge *)bridge {
20-
_bridge = bridge;
23+
if (cxxBridge == nil) {
24+
return @false;
25+
}
2126

22-
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
23-
if (!cxxBridge.runtime) {
24-
return;
25-
}
27+
auto jsiRuntime = (jsi::Runtime*) cxxBridge.runtime;
28+
if (jsiRuntime == nil) {
29+
return @false;
30+
}
2631

27-
auto jsiRuntime = (jsi::Runtime*)cxxBridge.runtime;
32+
xxhash::install(jsiRuntime);
2833

29-
xxhash::install(jsiRuntime);
34+
return @true;
3035
}
3136

3237

33-
3438
@end

0 commit comments

Comments
 (0)