@crossbind/plugin-react-native-ios-helper 2.0.0-beta.58 → 2.0.0-beta.60
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ios/CrossbindModule.mm +21 -10
- package/package.json +1 -1
package/ios/CrossbindModule.mm
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
#import "CrossbindModule.h"
|
|
2
2
|
#import <React/RCTLog.h>
|
|
3
|
-
#import <React/RCTBridge+Private.h>
|
|
4
3
|
#import <React/RCTUtils.h>
|
|
4
|
+
#import <ReactCommon/RCTTurboModuleWithJSIBindings.h>
|
|
5
|
+
#import <RNCrossbindSpec/RNCrossbindSpec.h>
|
|
5
6
|
#include <jsi/jsi.h>
|
|
6
7
|
|
|
7
8
|
namespace emscripten {
|
|
@@ -12,22 +13,32 @@ __attribute__((used)) void _embind_initialize_bindings(facebook::jsi::Runtime& r
|
|
|
12
13
|
|
|
13
14
|
using namespace facebook;
|
|
14
15
|
|
|
16
|
+
@interface CrossbindModule () <NativeRNJsiLibSpec, RCTTurboModuleWithJSIBindings>
|
|
17
|
+
@end
|
|
18
|
+
|
|
15
19
|
@implementation CrossbindModule
|
|
16
|
-
@synthesize bridge = _bridge;
|
|
17
20
|
|
|
18
21
|
RCT_EXPORT_MODULE(RNJsiLib)
|
|
19
|
-
|
|
22
|
+
|
|
23
|
+
- (std::shared_ptr<react::TurboModule>)getTurboModule:(const react::ObjCTurboModule::InitParams &)params
|
|
24
|
+
{
|
|
25
|
+
return std::make_shared<react::NativeRNJsiLibSpecJSI>(params);
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// React Native calls this once per module instance, on the JS thread, before JS
|
|
29
|
+
// can reach the module. Registering the embind bindings a second time aborts
|
|
30
|
+
// with "Cannot register public name ... twice", so the one-shot contract has to
|
|
31
|
+
// live here rather than in start:.
|
|
32
|
+
- (void)installJSIBindingsWithRuntime:(jsi::Runtime &)runtime
|
|
33
|
+
callInvoker:(const std::shared_ptr<react::CallInvoker> &)callInvoker
|
|
20
34
|
{
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
NSString *mainBundlePath = [[NSBundle mainBundle] bundlePath];
|
|
24
|
-
emscripten::internal::_embind_initialize_bindings(*runtime, std::string([mainBundlePath UTF8String]));
|
|
25
|
-
return @true;
|
|
35
|
+
NSString *bundlePath = [[NSBundle mainBundle] bundlePath];
|
|
36
|
+
emscripten::internal::_embind_initialize_bindings(runtime, std::string([bundlePath UTF8String]));
|
|
26
37
|
}
|
|
27
38
|
|
|
28
|
-
- (void)
|
|
39
|
+
- (void)start:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject
|
|
29
40
|
{
|
|
30
|
-
|
|
41
|
+
resolve(@YES);
|
|
31
42
|
}
|
|
32
43
|
|
|
33
44
|
@end
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@crossbind/plugin-react-native-ios-helper",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.60",
|
|
4
4
|
"description": "crossbind React Native plugin ios helper: A tool for seamless C++ integration with React Native and Expo.",
|
|
5
5
|
"homepage": "https://github.com/crossbind/crossbind/tree/main/plugins/react-native-ios-helper#readme",
|
|
6
6
|
"repository": {
|