@rnx-kit/react-native-host 0.4.10 → 0.4.12

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/README.md CHANGED
@@ -26,12 +26,32 @@ npm add --save-dev @rnx-kit/react-native-host
26
26
 
27
27
  ### iOS/macOS
28
28
 
29
- > To see a working example how to use this library for iOS/macOS, please refer
30
- > to
31
- > [react-native-test-app](https://github.com/microsoft/react-native-test-app/tree/trunk/ios/ReactTestApp).
29
+ > [!NOTE]
30
+ >
31
+ > For a working example how to use this library for iOS/macOS, see
32
+ > [react-native-test-app](https://github.com/microsoft/react-native-test-app/commit/241ddaf83e74f5d53a9144bcfd52f8f948425fcb#diff-8c45578b4f5841935bf037692cf65041333e9415552dcde4ac6c77bac00cd1b5).
32
33
 
33
- [Autolinking](https://github.com/react-native-community/cli/blob/10.x/docs/autolinking.md)
34
- should make this module available to your app project.
34
+ To avoid accidental autolinking, `@rnx-kit/react-native-host` must be manually
35
+ linked. In your `Podfile`, add the following line:
36
+
37
+ ```rb
38
+ pod 'ReactNativeHost', :path => '../node_modules/@rnx-kit/react-native-host'
39
+ ```
40
+
41
+ Adjust the path accordingly to your project setup. If you prefer a more dynamic
42
+ approach, you can also try using this script:
43
+
44
+ ```rb
45
+ proj_dir = Pathname.new(__dir__)
46
+ proj_dir = proj_dir.parent until
47
+ File.exist?("#{proj_dir}/node_modules/@rnx-kit/react-native-host/ReactNativeHost.podspec") ||
48
+ proj_dir.expand_path.to_s == '/'
49
+
50
+ pod 'ReactNativeHost', :path => "#{proj_dir}/node_modules/@rnx-kit/react-native-host"
51
+ ```
52
+
53
+ Run `pod install` at least once to make sure it gets added to your project. Then
54
+ make the following changes:
35
55
 
36
56
  - Replace instances of `RCTBridgeDelegate` with `RNXHostConfig`. The latter is a
37
57
  superset and is backwards compatible.
@@ -48,6 +48,10 @@
48
48
 
49
49
  #endif // __has_include(<React/RCTAppSetupUtils.h>)
50
50
 
51
+ #if __has_include(<react/nativemodule/defaults/DefaultTurboModules.h>) // >= 0.75
52
+ #import <react/nativemodule/defaults/DefaultTurboModules.h>
53
+ #endif
54
+
51
55
  #endif // USE_FABRIC
52
56
 
53
57
  @implementation RNXTurboModuleAdapter {
@@ -89,7 +93,11 @@
89
93
  getTurboModule:(std::string const &)name
90
94
  jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
91
95
  {
96
+ #if __has_include(<react/nativemodule/defaults/DefaultTurboModules.h>) // >= 0.75
97
+ return facebook::react::DefaultTurboModules::getTurboModule(name, jsInvoker);
98
+ #else
92
99
  return nullptr;
100
+ #endif // __has_include(<react/nativemodule/defaults/DefaultTurboModules.h>)
93
101
  }
94
102
 
95
103
  - (id<RCTTurboModule>)getModuleInstanceFromClass:(Class)moduleClass
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.4.10",
3
+ "version": "0.4.12",
4
4
  "description": "Simplify React Native initialization",
5
5
  "homepage": "https://github.com/microsoft/rnx-kit/tree/main/packages/react-native-host#readme",
6
6
  "license": "MIT",