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
2 changes: 2 additions & 0 deletions packages/react-native/Libraries/AppDelegate/RCTAppDelegate.mm
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,8 @@ - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(

if (enableBridgeless) {
#if RCT_NEW_ARCH_ENABLED
// Enable native view config interop only if both bridgeless mode and Fabric is enabled.
RCTSetUseNativeViewConfigsInBridgelessMode([self fabricEnabled]);
[self createReactHost];
[self unstable_registerLegacyComponents];
[RCTComponentViewFactory currentComponentViewFactory].thirdPartyFabricComponentsProvider = self;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
import type {RootTag} from '../Types/RootTagTypes';

import {unstable_hasComponent} from '../NativeComponent/NativeComponentRegistryUnstable';
import ReactNativeFeatureFlags from './ReactNativeFeatureFlags';

let cachedConstants = null;

Expand All @@ -22,6 +21,10 @@ const errorMessageForMethod = (methodName: string): string =>
methodName +
"' is not available in the new React Native architecture.";

function nativeViewConfigsInBridgelessModeEnabled(): boolean {
return global.RN$LegacyInterop_UIManager_getConstants !== undefined;
}

function getCachedConstants(): Object {
if (!cachedConstants) {
cachedConstants = global.RN$LegacyInterop_UIManager_getConstants();
Expand All @@ -31,7 +34,7 @@ function getCachedConstants(): Object {

const UIManagerJS: {[string]: $FlowFixMe} = {
getViewManagerConfig: (viewManagerName: string): mixed => {
if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
if (nativeViewConfigsInBridgelessModeEnabled()) {
return getCachedConstants()[viewManagerName];
} else {
console.error(
Expand All @@ -46,7 +49,7 @@ const UIManagerJS: {[string]: $FlowFixMe} = {
return unstable_hasComponent(viewManagerName);
},
getConstants: (): Object => {
if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
if (nativeViewConfigsInBridgelessModeEnabled()) {
return getCachedConstants();
} else {
console.error(errorMessageForMethod('getConstants'));
Expand Down Expand Up @@ -179,7 +182,7 @@ const UIManagerJS: {[string]: $FlowFixMe} = {
console.error(errorMessageForMethod('dismissPopupMenu')),
};

if (ReactNativeFeatureFlags.enableNativeViewConfigsInBridgelessMode()) {
if (nativeViewConfigsInBridgelessModeEnabled()) {
Object.keys(getCachedConstants()).forEach(viewConfigName => {
UIManagerJS[viewConfigName] = getCachedConstants()[viewConfigName];
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,10 +54,6 @@ export type FeatureFlags = {|
* Enables use of setNativeProps in JS driven animations.
*/
shouldUseSetNativePropsInFabric: () => boolean,
/**
* Enables native view configs in brdgeless mode.
*/
enableNativeViewConfigsInBridgelessMode: () => boolean,
/**
* Enables a hotfix for forcing materialization of views with elevation set.
*/
Expand All @@ -74,7 +70,6 @@ const ReactNativeFeatureFlags: FeatureFlags = {
enableAccessToHostTreeInFabric: () => false,
shouldUseAnimatedObjectForTransform: () => false,
shouldUseSetNativePropsInFabric: () => false,
enableNativeViewConfigsInBridgelessMode: () => false,
shouldForceUnflattenForElevation: () => false,
};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ object DefaultNewArchitectureEntryPoint {
ReactFeatureFlags.enableFabricRenderer = fabricEnabled
ReactFeatureFlags.unstable_useFabricInterop = fabricEnabled
ReactFeatureFlags.enableBridgelessArchitecture = bridgelessEnabled
ReactFeatureFlags.useNativeViewConfigsInBridgelessMode = fabricEnabled && bridgelessEnabled

this.privateFabricEnabled = fabricEnabled
this.privateTurboModulesEnabled = turboModulesEnabled
Expand Down