@rnx-kit/react-native-host 0.4.2 → 0.4.3

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.
@@ -67,13 +67,13 @@
67
67
 
68
68
  // MARK: - RCTTurboModuleManagerDelegate details
69
69
 
70
- - (Class)getModuleClassFromName:(const char *)name
70
+ - (Class)getModuleClassFromName:(char const *)name
71
71
  {
72
72
  return RCTCoreModulesClassProvider(name);
73
73
  }
74
74
 
75
75
  - (std::shared_ptr<facebook::react::TurboModule>)
76
- getTurboModule:(const std::string &)name
76
+ getTurboModule:(std::string const &)name
77
77
  jsInvoker:(std::shared_ptr<facebook::react::CallInvoker>)jsInvoker
78
78
  {
79
79
  return nullptr;
@@ -7,6 +7,7 @@
7
7
  #import <React/RCTFabricSurface.h>
8
8
  #import <React/RCTSurfaceHostingProxyRootView.h>
9
9
  #endif // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
10
+ static NSString *const kReactConcurrentRoot = @"concurrentRoot";
10
11
  #else
11
12
  #import <React/RCTRootView.h>
12
13
  #endif // USE_FABRIC
@@ -36,15 +37,27 @@
36
37
  initialProperties:(NSDictionary *)initialProperties;
37
38
  {
38
39
  #ifdef USE_FABRIC
40
+ // Having `concurrentRoot` disabled when Fabric is enabled is not recommended:
41
+ // https://github.com/facebook/react-native/commit/7eaabfb174b14a30c30c7017195e8110348e5f44
42
+ // As of 0.74, it won't be possible to opt-out:
43
+ // https://github.com/facebook/react-native/commit/30d186c3683228d4fb7a42f804eb2fdfa7c8ac03
44
+ NSMutableDictionary *initialProps =
45
+ initialProperties == nil
46
+ ? [NSMutableDictionary dictionaryWithObjectsAndKeys:@YES, kReactConcurrentRoot, nil]
47
+ : [initialProperties mutableCopy];
48
+ if (initialProps[kReactConcurrentRoot] == nil) {
49
+ initialProps[kReactConcurrentRoot] = @YES;
50
+ }
51
+
39
52
  #if __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
40
53
  return [[RCTFabricSurfaceHostingProxyRootView alloc] initWithBridge:self.bridge
41
54
  moduleName:moduleName
42
- initialProperties:initialProperties];
55
+ initialProperties:initialProps];
43
56
  #else
44
57
  RCTFabricSurface *surface =
45
58
  [[RCTFabricSurface alloc] initWithSurfacePresenter:self.surfacePresenter
46
59
  moduleName:moduleName
47
- initialProperties:initialProperties];
60
+ initialProperties:initialProps];
48
61
  return [[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];
49
62
  #endif // __has_include(<React/RCTFabricSurfaceHostingProxyRootView.h>)
50
63
  #else
@@ -126,7 +126,7 @@ using ReactNativeConfig = facebook::react::EmptyReactNativeConfig const;
126
126
 
127
127
  - (void)usingModule:(Class)moduleClass block:(void (^)(id<RCTBridgeModule> _Nullable))block
128
128
  {
129
- const BOOL requiresMainQueueSetup =
129
+ BOOL const requiresMainQueueSetup =
130
130
  [moduleClass respondsToSelector:@selector(requiresMainQueueSetup)] &&
131
131
  [moduleClass requiresMainQueueSetup];
132
132
  if (requiresMainQueueSetup && !RCTIsMainQueue()) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rnx-kit/react-native-host",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
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",