@@ -49,6 +49,19 @@ @interface RCTAppDelegate () <
49
49
50
50
#endif
51
51
52
+ static NSDictionary *updateInitialProps (NSDictionary *initialProps, BOOL isFabricEnabled)
53
+ {
54
+ #ifdef RCT_NEW_ARCH_ENABLED
55
+ NSMutableDictionary *mutableProps = [initialProps mutableCopy ] ?: [NSMutableDictionary new ];
56
+ // Hardcoding the Concurrent Root as it it not recommended to
57
+ // have the concurrentRoot turned off when Fabric is enabled.
58
+ mutableProps[kRNConcurrentRoot ] = @(isFabricEnabled);
59
+ return mutableProps;
60
+ #else
61
+ return initialProps;
62
+ #endif
63
+ }
64
+
52
65
@interface RCTAppDelegate () <RCTCxxBridgeDelegate> {
53
66
std::shared_ptr<facebook::react::RuntimeScheduler> _runtimeScheduler;
54
67
}
@@ -76,10 +89,13 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
76
89
{
77
90
BOOL enableTM = NO ;
78
91
BOOL enableBridgeless = NO ;
92
+ BOOL fabricEnabled = NO ;
79
93
#if RCT_NEW_ARCH_ENABLED
80
94
enableTM = self.turboModuleEnabled ;
81
95
enableBridgeless = self.bridgelessEnabled ;
96
+ fabricEnabled = [self fabricEnabled ];
82
97
#endif
98
+ NSDictionary *initProps = updateInitialProps ([self prepareInitialProps ], fabricEnabled);
83
99
84
100
RCTAppSetupPrepareApp (application, enableTM);
85
101
@@ -88,7 +104,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
88
104
if (enableBridgeless) {
89
105
#if RCT_NEW_ARCH_ENABLED
90
106
// Enable native view config interop only if both bridgeless mode and Fabric is enabled.
91
- RCTSetUseNativeViewConfigsInBridgelessMode ([ self fabricEnabled ] );
107
+ RCTSetUseNativeViewConfigsInBridgelessMode (fabricEnabled);
92
108
93
109
// Enable TurboModule interop by default in Bridgeless mode
94
110
RCTEnableTurboModuleInterop (YES );
@@ -97,8 +113,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
97
113
[self createReactHost ];
98
114
[self unstable_registerLegacyComponents ];
99
115
[RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
100
- RCTFabricSurface *surface = [_reactHost createSurfaceWithModuleName: self .moduleName
101
- initialProperties: launchOptions];
116
+ RCTFabricSurface *surface = [_reactHost createSurfaceWithModuleName: self .moduleName initialProperties: initProps];
102
117
103
118
RCTSurfaceHostingProxyRootView *surfaceHostingProxyRootView = [[RCTSurfaceHostingProxyRootView alloc ]
104
119
initWithSurface: surface
@@ -118,7 +133,7 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(
118
133
[self unstable_registerLegacyComponents ];
119
134
[RCTComponentViewFactory currentComponentViewFactory ].thirdPartyFabricComponentsProvider = self;
120
135
#endif
121
- NSDictionary *initProps = [ self prepareInitialProps ];
136
+
122
137
rootView = [self createRootViewWithBridge: self .bridge moduleName: self .moduleName initProps: initProps];
123
138
}
124
139
self.window = [[UIWindow alloc ] initWithFrame: [UIScreen mainScreen ].bounds];
@@ -140,15 +155,7 @@ - (NSURL *)sourceURLForBridge:(RCTBridge *)bridge
140
155
141
156
- (NSDictionary *)prepareInitialProps
142
157
{
143
- NSMutableDictionary *initProps = self.initialProps ? [self .initialProps mutableCopy ] : [NSMutableDictionary new ];
144
-
145
- #ifdef RCT_NEW_ARCH_ENABLED
146
- // Hardcoding the Concurrent Root as it it not recommended to
147
- // have the concurrentRoot turned off when Fabric is enabled.
148
- initProps[kRNConcurrentRoot ] = @([self fabricEnabled ]);
149
- #endif
150
-
151
- return initProps;
158
+ return self.initialProps ;
152
159
}
153
160
154
161
- (RCTBridge *)createBridgeWithDelegate : (id <RCTBridgeDelegate>)delegate launchOptions : (NSDictionary *)launchOptions
0 commit comments