Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 6 additions & 21 deletions packages/react-native/Libraries/AppDelegate/RCTRootViewFactory.mm
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,6 @@
#import <react/renderer/runtimescheduler/RuntimeSchedulerCallInvoker.h>
#import <react/runtime/JSRuntimeFactory.h>

static NSString *const kRNConcurrentRoot = @"concurrentRoot";

static NSDictionary *updateInitialProps(NSDictionary *initialProps, BOOL isFabricEnabled)
{
NSMutableDictionary *mutableProps = initialProps != NULL ? [initialProps mutableCopy] : [NSMutableDictionary new];
// Hardcoding the Concurrent Root as it it not recommended to
// have the concurrentRoot turned off when Fabric is enabled.
mutableProps[kRNConcurrentRoot] = @(isFabricEnabled);
return mutableProps;
}

@implementation RCTRootViewFactoryConfiguration

- (instancetype)initWithBundleURL:(NSURL *)bundleURL newArchEnabled:(BOOL)newArchEnabled
Expand Down Expand Up @@ -149,11 +138,9 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
}

- (UIView *)viewWithModuleName:(NSString *)moduleName
initialProperties:(NSDictionary *)initialProperties
initialProperties:(NSDictionary *)initProps
launchOptions:(NSDictionary *)launchOptions
{
NSDictionary *initProps = updateInitialProps(initialProperties, _configuration.fabricEnabled);

if (_configuration.bridgelessEnabled) {
// Enable TurboModule interop by default in Bridgeless mode
RCTEnableTurboModuleInterop(YES);
Expand All @@ -167,8 +154,8 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
[[RCTSurfaceHostingProxyRootView alloc] initWithSurface:surface];

surfaceHostingProxyRootView.backgroundColor = [UIColor systemBackgroundColor];
if (self->_configuration.customizeRootView != nil) {
self->_configuration.customizeRootView(surfaceHostingProxyRootView);
if (_configuration.customizeRootView != nil) {
_configuration.customizeRootView(surfaceHostingProxyRootView);
}
return surfaceHostingProxyRootView;
}
Expand All @@ -182,8 +169,8 @@ - (UIView *)viewWithModuleName:(NSString *)moduleName
} else {
rootView = [self createRootViewWithBridge:self.bridge moduleName:moduleName initProps:initProps];
}
if (self->_configuration.customizeRootView != nil) {
self->_configuration.customizeRootView(rootView);
if (_configuration.customizeRootView != nil) {
_configuration.customizeRootView(rootView);
}
return rootView;
}
Expand All @@ -197,11 +184,9 @@ - (UIView *)createRootViewWithBridge:(RCTBridge *)bridge
moduleName:(NSString *)moduleName
initProps:(NSDictionary *)initProps
{
BOOL enableFabric = self->_configuration.fabricEnabled;
BOOL enableFabric = _configuration.fabricEnabled;
UIView *rootView = RCTAppSetupDefaultRootView(bridge, moduleName, initProps, enableFabric);

rootView.backgroundColor = [UIColor systemBackgroundColor];

return rootView;
}

Expand Down
6 changes: 0 additions & 6 deletions packages/react-native/Libraries/ReactNative/AppRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ type AppParameters = {
initialProps: $ReadOnly<{[string]: mixed, ...}>,
rootTag: RootTag,
fabric?: boolean,
concurrentRoot?: boolean,
};
export type Runnable = (
appParameters: AppParameters,
Expand Down Expand Up @@ -120,10 +119,6 @@ const AppRegistry = {
): string {
const scopedPerformanceLogger = createPerformanceLogger();
runnables[appKey] = (appParameters, displayMode) => {
const concurrentRootEnabled = Boolean(
appParameters.initialProps?.concurrentRoot ||
appParameters.concurrentRoot,
);
renderApplication(
componentProviderInstrumentationHook(
componentProvider,
Expand All @@ -138,7 +133,6 @@ const AppRegistry = {
appKey === 'LogBox', // is logbox
appKey,
displayMode,
concurrentRootEnabled,
);
};
if (section) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ export default function renderApplication<Props: Object>(
isLogBox?: boolean,
debugName?: string,
displayMode?: ?DisplayModeType,
useConcurrentRoot?: boolean,
useOffscreen?: boolean,
) {
invariant(rootTag, 'Expect to have a valid rootTag, instead got ', rootTag);
Expand Down Expand Up @@ -87,12 +86,12 @@ export default function renderApplication<Props: Object>(
}

// We want to have concurrentRoot always enabled when you're on Fabric.
const useConcurrentRootOverride = fabric;
const useConcurrentRoot = Boolean(fabric);

performanceLogger.startTimespan('renderApplication_React_render');
performanceLogger.setExtra(
'usedReactConcurrentRoot',
useConcurrentRootOverride ? '1' : '0',
useConcurrentRoot ? '1' : '0',
);
performanceLogger.setExtra('usedReactFabric', fabric ? '1' : '0');
performanceLogger.setExtra(
Expand All @@ -103,7 +102,7 @@ export default function renderApplication<Props: Object>(
element: renderable,
rootTag,
useFabric: Boolean(fabric),
useConcurrentRoot: Boolean(useConcurrentRootOverride),
useConcurrentRoot,
});
performanceLogger.stopTimespan('renderApplication_React_render');
}
Original file line number Diff line number Diff line change
Expand Up @@ -7381,7 +7381,6 @@ type AppParameters = {
initialProps: $ReadOnly<{ [string]: mixed, ... }>,
rootTag: RootTag,
fabric?: boolean,
concurrentRoot?: boolean,
};
export type Runnable = (
appParameters: AppParameters,
Expand Down Expand Up @@ -7741,7 +7740,6 @@ exports[`public API should not change unintentionally Libraries/ReactNative/rend
isLogBox?: boolean,
debugName?: string,
displayMode?: ?DisplayModeType,
useConcurrentRoot?: boolean,
useOffscreen?: boolean
): void;
"
Expand Down