@rnx-kit/react-native-host 0.4.4 → 0.4.5

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.
@@ -18,6 +18,15 @@ using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSEngineInstance
18
18
  using SharedJSRuntimeFactory = std::shared_ptr<facebook::react::JSRuntimeFactory>;
19
19
  #endif // __has_include(<react/runtime/JSEngineInstance.h>)
20
20
 
21
+ // For details, see
22
+ // https://github.com/facebook/react-native/commit/c3b0a8f1626939cf5c7b3864a5acf9d3dad26fb3
23
+ @interface RCTHost (Compatibility)
24
+ @property (nonatomic, readonly) RCTModuleRegistry *moduleRegistry; // Introduced in 0.74
25
+ @property (nonatomic, readonly) RCTSurfacePresenter *surfacePresenter; // Introduced in 0.74
26
+ - (RCTModuleRegistry *)getModuleRegistry; // Deprecated in 0.74, and removed in 0.75
27
+ - (RCTSurfacePresenter *)getSurfacePresenter; // Deprecated in 0.74, and removed in 0.75
28
+ @end
29
+
21
30
  #elif USE_FABRIC
22
31
 
23
32
  #import <React/RCTSurfacePresenterBridgeAdapter.h>
@@ -104,7 +104,9 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
104
104
  - (RCTSurfacePresenter *)surfacePresenter
105
105
  {
106
106
  #if USE_BRIDGELESS
107
- return [_reactHost getSurfacePresenter];
107
+ return [_reactHost respondsToSelector:@selector(surfacePresenter)]
108
+ ? _reactHost.surfacePresenter
109
+ : [_reactHost getSurfacePresenter];
108
110
  #elif USE_FABRIC
109
111
  return [_surfacePresenterBridgeAdapter surfacePresenter];
110
112
  #else
@@ -144,7 +146,10 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
144
146
 
145
147
  #if USE_BRIDGELESS
146
148
  const char *moduleName = RCTBridgeModuleNameForClass(moduleClass).UTF8String;
147
- block([[_reactHost getModuleRegistry] moduleForName:moduleName]);
149
+ RCTModuleRegistry *moduleRegistry = [_reactHost respondsToSelector:@selector(moduleRegistry)]
150
+ ? _reactHost.moduleRegistry
151
+ : [_reactHost getModuleRegistry];
152
+ block([moduleRegistry moduleForName:moduleName]);
148
153
  #endif // USE_BRIDGELESS
149
154
  }
150
155
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.4.4",
3
+ "version": "0.4.5",
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",