Skip to content

Commit 8e2c1fe

Browse files
committed
fix: ios installation
1 parent 7ac00ae commit 8e2c1fe

File tree

2 files changed

+8
-20
lines changed

2 files changed

+8
-20
lines changed

ios/RNGetRandomValues.h

-3
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
#import <React/RCTBridgeModule.h>
2-
#import "react-native-get-random-values.h"
32

43
@interface RNGetRandomValues : NSObject <RCTBridgeModule>
54

6-
@property(nonatomic, assign) BOOL setBridgeOnMainQueue;
7-
85
@end

ios/RNGetRandomValues.mm

+8-17
Original file line numberDiff line numberDiff line change
@@ -6,27 +6,18 @@
66

77
@implementation RNGetRandomValues
88

9-
@synthesize bridge = _bridge;
10-
@synthesize methodQueue = _methodQueue;
11-
129
RCT_EXPORT_MODULE();
1310

14-
+ (BOOL)requiresMainQueueSetup {
15-
return YES;
16-
}
17-
18-
- (void)setBridge:(RCTBridge *)bridge {
19-
_bridge = bridge;
20-
_setBridgeOnMainQueue = RCTIsMainQueue();
21-
[self installLibrary];
22-
}
23-
24-
- (void)installLibrary {
25-
RCTCxxBridge *cxxBridge = (RCTCxxBridge *)self.bridge;
11+
RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(install) {
12+
RCTBridge* bridge = [RCTBridge currentBridge];
13+
RCTCxxBridge* cxxBridge = (RCTCxxBridge*)bridge;
2614

27-
if (cxxBridge.runtime) {
15+
if (cxxBridge.runtime) {
2816
reactnativegetrandomvalues::install(*(facebook::jsi::Runtime *)cxxBridge.runtime);
29-
}
17+
return @true;
18+
}
19+
20+
return @false;
3021
}
3122

3223
@end

0 commit comments

Comments
 (0)