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