Skip to content

Commit c698698

Browse files
authored
Move and simplify Apple host TurboModule (#301)
* Moved "ios" into a shared "apple" directory * Simplify Apple host module provider * Add changeset
1 parent 51eacad commit c698698

File tree

4 files changed

+27
-45
lines changed

4 files changed

+27
-45
lines changed

.changeset/sad-poets-smoke.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"react-native-node-api": patch
3+
---
4+
5+
Moved and simplify Apple host TurboModule
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#import "CxxNodeApiHostModule.hpp"
2+
#import "WeakNodeApiInjector.hpp"
3+
4+
#import <ReactCommon/CxxTurboModuleUtils.h>
5+
@interface NodeApiHost : NSObject
6+
7+
@end
8+
9+
@implementation NodeApiHost
10+
+ (void)load {
11+
callstack::nodeapihost::injectIntoWeakNodeApi();
12+
13+
facebook::react::registerCxxModuleToGlobalModuleMap(
14+
callstack::nodeapihost::CxxNodeApiHostModule::kModuleName,
15+
[](std::shared_ptr<facebook::react::CallInvoker> jsInvoker) {
16+
return std::make_shared<callstack::nodeapihost::CxxNodeApiHostModule>(
17+
jsInvoker);
18+
});
19+
}
20+
21+
@end

packages/host/ios/NodeApiHostModuleProvider.mm

Lines changed: 0 additions & 44 deletions
This file was deleted.

packages/host/react-native-node-api.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ Pod::Spec.new do |s|
3232
s.platforms = { :ios => min_ios_version_supported }
3333
s.source = { :git => "https://github.com/callstackincubator/react-native-node-api.git", :tag => "#{s.version}" }
3434

35-
s.source_files = "ios/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "weak-node-api/include/*.h", "weak-node-api/*.hpp"
35+
s.source_files = "apple/**/*.{h,m,mm}", "cpp/**/*.{hpp,cpp,c,h}", "weak-node-api/include/*.h", "weak-node-api/*.hpp"
3636
s.public_header_files = "weak-node-api/include/*.h"
3737

3838
s.vendored_frameworks = "auto-linked/apple/*.xcframework", "weak-node-api/weak-node-api.xcframework"

0 commit comments

Comments
 (0)