diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java index c5dfeb33de14f9..1b067c96062017 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/HeadlessJsTaskService.java @@ -19,7 +19,7 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.ReactContext; import com.facebook.react.bridge.UiThreadUtil; -import com.facebook.react.config.ReactFeatureFlags; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.jstasks.HeadlessJsTaskConfig; import com.facebook.react.jstasks.HeadlessJsTaskContext; import com.facebook.react.jstasks.HeadlessJsTaskEventListener; @@ -171,7 +171,7 @@ protected ReactNativeHost getReactNativeHost() { } protected ReactContext getReactContext() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { ReactHost reactHost = getReactHost(); Assertions.assertNotNull(reactHost, "getReactHost() is null in New Architecture"); return reactHost.getCurrentReactContext(); diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java index a97ca10328ed73..f1c20a67347030 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactActivityDelegate.java @@ -19,6 +19,7 @@ import com.facebook.infer.annotation.Assertions; import com.facebook.react.bridge.Callback; import com.facebook.react.config.ReactFeatureFlags; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.modules.core.PermissionListener; /** @@ -107,7 +108,7 @@ public void onCreate(Bundle savedInstanceState) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O && isWideColorGamutEnabled()) { mActivity.getWindow().setColorMode(ActivityInfo.COLOR_MODE_WIDE_COLOR_GAMUT); } - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactDelegate = new ReactDelegate(getPlainActivity(), getReactHost(), mainComponentName, launchOptions); } else { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java index 66ba98fc91c6df..7793fd2704b4b4 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactDelegate.java @@ -20,6 +20,7 @@ import com.facebook.react.devsupport.ReleaseDevSupportManager; import com.facebook.react.devsupport.interfaces.DevSupportManager; import com.facebook.react.interfaces.fabric.ReactSurface; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.modules.core.DefaultHardwareBackBtnHandler; /** @@ -94,7 +95,7 @@ public ReactDelegate( @Nullable private DevSupportManager getDevSupportManager() { - if (ReactFeatureFlags.enableBridgelessArchitecture + if (ReactNativeFeatureFlags.enableBridgelessArchitecture() && mReactHost != null && mReactHost.getDevSupportManager() != null) { return mReactHost.getDevSupportManager(); @@ -111,7 +112,7 @@ public void onHostResume() { throw new ClassCastException( "Host Activity does not implement DefaultHardwareBackBtnHandler"); } - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onHostResume(mActivity, (DefaultHardwareBackBtnHandler) mActivity); } else { if (getReactNativeHost().hasInstance()) { @@ -123,7 +124,7 @@ public void onHostResume() { } public void onUserLeaveHint() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onHostLeaveHint(mActivity); } else { if (getReactNativeHost().hasInstance()) { @@ -133,7 +134,7 @@ public void onUserLeaveHint() { } public void onHostPause() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onHostPause(mActivity); } else { if (getReactNativeHost().hasInstance()) { @@ -143,7 +144,7 @@ public void onHostPause() { } public void onHostDestroy() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { if (mReactSurface != null) { mReactSurface.stop(); mReactSurface = null; @@ -161,7 +162,7 @@ public void onHostDestroy() { } public boolean onBackPressed() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onBackPressed(); return true; } else { @@ -174,7 +175,7 @@ public boolean onBackPressed() { } public boolean onNewIntent(Intent intent) { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onNewIntent(intent); return true; } else { @@ -188,7 +189,7 @@ public boolean onNewIntent(Intent intent) { public void onActivityResult( int requestCode, int resultCode, Intent data, boolean shouldForwardToReactInstance) { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onActivityResult(mActivity, requestCode, resultCode, data); } else { if (getReactNativeHost().hasInstance() && shouldForwardToReactInstance) { @@ -200,7 +201,7 @@ public void onActivityResult( } public void onWindowFocusChanged(boolean hasFocus) { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onWindowFocusChange(hasFocus); } else { if (getReactNativeHost().hasInstance()) { @@ -210,7 +211,7 @@ public void onWindowFocusChanged(boolean hasFocus) { } public void onConfigurationChanged(Configuration newConfig) { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mReactHost.onConfigurationChanged(Assertions.assertNotNull(mActivity)); } else { if (getReactNativeHost().hasInstance()) { @@ -222,7 +223,7 @@ public void onConfigurationChanged(Configuration newConfig) { public boolean onKeyDown(int keyCode, KeyEvent event) { if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD - && ((ReactFeatureFlags.enableBridgelessArchitecture + && ((ReactNativeFeatureFlags.enableBridgelessArchitecture() && mReactHost != null && mReactHost.getDevSupportManager() != null) || (getReactNativeHost().hasInstance() @@ -235,7 +236,7 @@ && getReactNativeHost().getUseDeveloperSupport()))) { public boolean onKeyLongPress(int keyCode) { if (keyCode == KeyEvent.KEYCODE_MEDIA_FAST_FORWARD) { - if (ReactFeatureFlags.enableBridgelessArchitecture && mReactHost != null) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture() && mReactHost != null) { DevSupportManager devSupportManager = mReactHost.getDevSupportManager(); // onKeyLongPress is a Dev API and not supported in RELEASE mode. if (devSupportManager != null && !(devSupportManager instanceof ReleaseDevSupportManager)) { @@ -261,7 +262,7 @@ public void reload() { // Reload in RELEASE mode if (devSupportManager instanceof ReleaseDevSupportManager) { // Do not reload the bundle from JS as there is no bundler running in release mode. - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { if (mReactHost != null) { mReactHost.reload("ReactDelegate.reload()"); } @@ -287,7 +288,7 @@ public void loadApp() { public void loadApp(String appKey) { // With Bridgeless enabled, create and start the surface - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { if (mReactSurface == null) { // Create a ReactSurface mReactSurface = mReactHost.createSurface(mActivity, appKey, mLaunchOptions); @@ -306,7 +307,7 @@ public void loadApp(String appKey) { } public ReactRootView getReactRootView() { - if (ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactNativeFeatureFlags.enableBridgelessArchitecture()) { return (ReactRootView) mReactSurface.getView(); } else { return mReactRootView; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java index d04bb7d0261a3c..7cde732f7b402f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactPackageTurboModuleManagerDelegate.java @@ -15,6 +15,7 @@ import com.facebook.react.bridge.NativeModule; import com.facebook.react.bridge.ReactApplicationContext; import com.facebook.react.config.ReactFeatureFlags; +import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.internal.turbomodule.core.TurboModuleManagerDelegate; import com.facebook.react.module.annotations.ReactModule; import com.facebook.react.module.model.ReactModuleInfo; @@ -36,7 +37,7 @@ interface ModuleProvider { new HashMap<>(); private final boolean mShouldEnableLegacyModuleInterop = - ReactFeatureFlags.enableBridgelessArchitecture + ReactNativeFeatureFlags.enableBridgelessArchitecture() && ReactFeatureFlags.unstable_useTurboModuleInterop; private final boolean mEnableTurboModuleSyncVoidMethods = diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java index 0e16c506580031..f3a962516864d7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/config/ReactFeatureFlags.java @@ -44,6 +44,12 @@ public class ReactFeatureFlags { */ public static volatile boolean enableFabricRenderer = false; + /** + * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable + * the following flags: `useTurboModules` & `enableFabricRenderer`. + */ + public static boolean enableBridgelessArchitecture = false; + /** * Should this application enable the Fabric Interop Layer for Android? If yes, the application * will behave so that it can accept non-Fabric components and render them on Fabric. This toggle @@ -52,12 +58,6 @@ public class ReactFeatureFlags { */ public static volatile boolean unstable_useFabricInterop = false; - /** - * Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable - * the following flags: `useTurboModules` & `enableFabricRenderer`. - */ - public static boolean enableBridgelessArchitecture = false; - /** This feature flag enables logs for Fabric */ public static boolean enableFabricLogs = false; diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt index 0f8dfad5146109..d92853aced8377 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/defaults/DefaultNewArchitectureEntryPoint.kt @@ -43,7 +43,6 @@ public object DefaultNewArchitectureEntryPoint { ReactFeatureFlags.useTurboModules = turboModulesEnabled ReactFeatureFlags.enableFabricRenderer = fabricEnabled ReactFeatureFlags.unstable_useFabricInterop = fabricEnabled - ReactFeatureFlags.enableBridgelessArchitecture = bridgelessEnabled ReactFeatureFlags.unstable_useTurboModuleInterop = bridgelessEnabled val fuseboxEnabledDebug = fuseboxEnabled @@ -54,6 +53,8 @@ public object DefaultNewArchitectureEntryPoint { override fun enableMicrotasks(): Boolean = true + override fun enableBridgelessArchitecture(): Boolean = bridgelessEnabled + override fun batchRenderingUpdatesInEventLoop(): Boolean = true override fun useNativeViewConfigsInBridgelessMode(): Boolean = true diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java index 6fbda22fd51c8d..871466ee7cd811 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/fabric/FabricUIManager.java @@ -454,7 +454,7 @@ public void invalidate() { // responsible for initializing and deallocating EventDispatcher. StaticViewConfigs is enabled // only in Bridgeless for now. // TODO T83943316: Remove this IF once StaticViewConfigs are enabled by default - if (!ReactFeatureFlags.enableBridgelessArchitecture) { + if (!ReactNativeFeatureFlags.enableBridgelessArchitecture()) { mEventDispatcher.onCatalystInstanceDestroyed(); } } diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt index 73e48c14e05de1..b1c43a2d877d04 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<4a2baeeff0b03f07a259028cf4446455>> + * @generated SignedSource<<93a8869f0714b3c8913ceba6a7c4056a>> */ /** @@ -76,6 +76,12 @@ public object ReactNativeFeatureFlags { @JvmStatic public fun enableAlignItemsBaselineOnFabricIOS(): Boolean = accessor.enableAlignItemsBaselineOnFabricIOS() + /** + * Enables the Bridgeless Architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer` + */ + @JvmStatic + public fun enableBridgelessArchitecture(): Boolean = accessor.enableBridgelessArchitecture() + /** * Clean yoga node when does not change. */ diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt index f65acaa57ad8bb..fae52d4ab68f36 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7fbe53bfb2b06cdae8b1590c9131edbb>> + * @generated SignedSource<<7e74e4f03693eb883b563bf3bcefaeb0>> */ /** @@ -28,6 +28,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null + private var enableBridgelessArchitectureCache: Boolean? = null private var enableCleanTextInputYogaNodeCache: Boolean? = null private var enableFabricRendererExclusivelyCache: Boolean? = null private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null @@ -129,6 +130,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso return cached } + override fun enableBridgelessArchitecture(): Boolean { + var cached = enableBridgelessArchitectureCache + if (cached == null) { + cached = ReactNativeFeatureFlagsCxxInterop.enableBridgelessArchitecture() + enableBridgelessArchitectureCache = cached + } + return cached + } + override fun enableCleanTextInputYogaNode(): Boolean { var cached = enableCleanTextInputYogaNodeCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt index c19a1f89cd461e..7394550fe6090f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -44,6 +44,8 @@ public object ReactNativeFeatureFlagsCxxInterop { @DoNotStrip @JvmStatic public external fun enableAlignItemsBaselineOnFabricIOS(): Boolean + @DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean + @DoNotStrip @JvmStatic public external fun enableCleanTextInputYogaNode(): Boolean @DoNotStrip @JvmStatic public external fun enableFabricRendererExclusively(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt index 638e594f5d9bfa..48e9242dcb929f 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<36ce43a58cd2608672ce4f8a475e26ad>> */ /** @@ -39,6 +39,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi override fun enableAlignItemsBaselineOnFabricIOS(): Boolean = true + override fun enableBridgelessArchitecture(): Boolean = false + override fun enableCleanTextInputYogaNode(): Boolean = false override fun enableFabricRendererExclusively(): Boolean = false diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt index 32d4d580023cdc..910c7c814ae3f7 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<483b7237b8b64398625d8ca203fe18dc>> */ /** @@ -32,6 +32,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null + private var enableBridgelessArchitectureCache: Boolean? = null private var enableCleanTextInputYogaNodeCache: Boolean? = null private var enableFabricRendererExclusivelyCache: Boolean? = null private var enableGranularShadowTreeStateReconciliationCache: Boolean? = null @@ -141,6 +142,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces return cached } + override fun enableBridgelessArchitecture(): Boolean { + var cached = enableBridgelessArchitectureCache + if (cached == null) { + cached = currentProvider.enableBridgelessArchitecture() + accessedFeatureFlags.add("enableBridgelessArchitecture") + enableBridgelessArchitectureCache = cached + } + return cached + } + override fun enableCleanTextInputYogaNode(): Boolean { var cached = enableCleanTextInputYogaNodeCache if (cached == null) { diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt index 07d5e57812b0e8..57a3b852bc0107 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<9c33a97e7e8c6917eeaab8bedf599995>> */ /** @@ -39,6 +39,8 @@ public interface ReactNativeFeatureFlagsProvider { @DoNotStrip public fun enableAlignItemsBaselineOnFabricIOS(): Boolean + @DoNotStrip public fun enableBridgelessArchitecture(): Boolean + @DoNotStrip public fun enableCleanTextInputYogaNode(): Boolean @DoNotStrip public fun enableFabricRendererExclusively(): Boolean diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java index 66e668e123935a..cab29fd6d09f2c 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/image/ReactImageView.java @@ -45,7 +45,6 @@ import com.facebook.react.bridge.ReadableArray; import com.facebook.react.bridge.ReadableMap; import com.facebook.react.common.build.ReactBuildConfig; -import com.facebook.react.config.ReactFeatureFlags; import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags; import com.facebook.react.modules.fresco.ReactNetworkImageRequest; import com.facebook.react.uimanager.FloatUtil; @@ -717,7 +716,7 @@ private void warnImageSource(String uri) { // 3. ReactImageView detects the null src; displays a warning in LogBox (via this code). // 3. LogBox renders an , which fabric preallocates. // 4. Rinse and repeat. - if (ReactBuildConfig.DEBUG && !ReactFeatureFlags.enableBridgelessArchitecture) { + if (ReactBuildConfig.DEBUG && !ReactNativeFeatureFlags.enableBridgelessArchitecture()) { RNLog.w( (ReactContext) getContext(), "ReactImageView: Image source \"" + uri + "\" doesn't exist"); diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp index 1f66dca3186c3d..0a89e09b5d4ea1 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<7671fb85b168f4eb8713fe087a9f1e31>> + * @generated SignedSource<> */ /** @@ -87,6 +87,12 @@ class ReactNativeFeatureFlagsProviderHolder return method(javaProvider_); } + bool enableBridgelessArchitecture() override { + static const auto method = + getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableBridgelessArchitecture"); + return method(javaProvider_); + } + bool enableCleanTextInputYogaNode() override { static const auto method = getReactNativeFeatureFlagsProviderJavaClass()->getMethod("enableCleanTextInputYogaNode"); @@ -299,6 +305,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS( return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(); } +bool JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture( + facebook::jni::alias_ref /*unused*/) { + return ReactNativeFeatureFlags::enableBridgelessArchitecture(); +} + bool JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode( facebook::jni::alias_ref /*unused*/) { return ReactNativeFeatureFlags::enableCleanTextInputYogaNode(); @@ -480,6 +491,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() { makeNativeMethod( "enableAlignItemsBaselineOnFabricIOS", JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS), + makeNativeMethod( + "enableBridgelessArchitecture", + JReactNativeFeatureFlagsCxxInterop::enableBridgelessArchitecture), makeNativeMethod( "enableCleanTextInputYogaNode", JReactNativeFeatureFlagsCxxInterop::enableCleanTextInputYogaNode), diff --git a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h index 4251014e2cde81..d860e31aa59978 100644 --- a/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h +++ b/packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<06b35c2faaf073589042046179aaf65a>> + * @generated SignedSource<<354aefa725713617bfaa4e6f5c3bb3cb>> */ /** @@ -54,6 +54,9 @@ class JReactNativeFeatureFlagsCxxInterop static bool enableAlignItemsBaselineOnFabricIOS( facebook::jni::alias_ref); + static bool enableBridgelessArchitecture( + facebook::jni::alias_ref); + static bool enableCleanTextInputYogaNode( facebook::jni::alias_ref); diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp index ed2087d47c5533..de459a2dee187d 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<541ad52f8b28ce4f72da4ce00cc7ba0e>> + * @generated SignedSource<> */ /** @@ -53,6 +53,10 @@ bool ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS() { return getAccessor().enableAlignItemsBaselineOnFabricIOS(); } +bool ReactNativeFeatureFlags::enableBridgelessArchitecture() { + return getAccessor().enableBridgelessArchitecture(); +} + bool ReactNativeFeatureFlags::enableCleanTextInputYogaNode() { return getAccessor().enableCleanTextInputYogaNode(); } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h index 93c2fc396612fd..d2ef05c21f276f 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8d5e69e5a5bab6f48008f2b68f1a3126>> + * @generated SignedSource<> */ /** @@ -77,6 +77,11 @@ class ReactNativeFeatureFlags { */ RN_EXPORT static bool enableAlignItemsBaselineOnFabricIOS(); + /** + * Enables the Bridgeless Architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer` + */ + RN_EXPORT static bool enableBridgelessArchitecture(); + /** * Clean yoga node when does not change. */ diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp index dee2f16ea9c1f0..bb528999c7a832 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<3ff5c0e239af49ce69f2655e7c2ee937>> + * @generated SignedSource<<1a96925b692031374138913a0248229b>> */ /** @@ -173,6 +173,24 @@ bool ReactNativeFeatureFlagsAccessor::enableAlignItemsBaselineOnFabricIOS() { return flagValue.value(); } +bool ReactNativeFeatureFlagsAccessor::enableBridgelessArchitecture() { + auto flagValue = enableBridgelessArchitecture_.load(); + + if (!flagValue.has_value()) { + // This block is not exclusive but it is not necessary. + // If multiple threads try to initialize the feature flag, we would only + // be accessing the provider multiple times but the end state of this + // instance and the returned flag value would be the same. + + markFlagAsAccessed(8, "enableBridgelessArchitecture"); + + flagValue = currentProvider_->enableBridgelessArchitecture(); + enableBridgelessArchitecture_ = flagValue; + } + + return flagValue.value(); +} + bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() { auto flagValue = enableCleanTextInputYogaNode_.load(); @@ -182,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(8, "enableCleanTextInputYogaNode"); + markFlagAsAccessed(9, "enableCleanTextInputYogaNode"); flagValue = currentProvider_->enableCleanTextInputYogaNode(); enableCleanTextInputYogaNode_ = flagValue; @@ -200,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricRendererExclusively() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(9, "enableFabricRendererExclusively"); + markFlagAsAccessed(10, "enableFabricRendererExclusively"); flagValue = currentProvider_->enableFabricRendererExclusively(); enableFabricRendererExclusively_ = flagValue; @@ -218,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::enableGranularShadowTreeStateReconciliatio // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(10, "enableGranularShadowTreeStateReconciliation"); + markFlagAsAccessed(11, "enableGranularShadowTreeStateReconciliation"); flagValue = currentProvider_->enableGranularShadowTreeStateReconciliation(); enableGranularShadowTreeStateReconciliation_ = flagValue; @@ -236,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLongTaskAPI() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(11, "enableLongTaskAPI"); + markFlagAsAccessed(12, "enableLongTaskAPI"); flagValue = currentProvider_->enableLongTaskAPI(); enableLongTaskAPI_ = flagValue; @@ -254,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(12, "enableMicrotasks"); + markFlagAsAccessed(13, "enableMicrotasks"); flagValue = currentProvider_->enableMicrotasks(); enableMicrotasks_ = flagValue; @@ -272,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(13, "enablePropsUpdateReconciliationAndroid"); + markFlagAsAccessed(14, "enablePropsUpdateReconciliationAndroid"); flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid(); enablePropsUpdateReconciliationAndroid_ = flagValue; @@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(14, "enableSynchronousStateUpdates"); + markFlagAsAccessed(15, "enableSynchronousStateUpdates"); flagValue = currentProvider_->enableSynchronousStateUpdates(); enableSynchronousStateUpdates_ = flagValue; @@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(15, "enableUIConsistency"); + markFlagAsAccessed(16, "enableUIConsistency"); flagValue = currentProvider_->enableUIConsistency(); enableUIConsistency_ = flagValue; @@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(16, "excludeYogaFromRawProps"); + markFlagAsAccessed(17, "excludeYogaFromRawProps"); flagValue = currentProvider_->excludeYogaFromRawProps(); excludeYogaFromRawProps_ = flagValue; @@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(17, "fetchImagesInViewPreallocation"); + markFlagAsAccessed(18, "fetchImagesInViewPreallocation"); flagValue = currentProvider_->fetchImagesInViewPreallocation(); fetchImagesInViewPreallocation_ = flagValue; @@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::fixIncorrectScrollViewStateUpdateOnAndroid // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(18, "fixIncorrectScrollViewStateUpdateOnAndroid"); + markFlagAsAccessed(19, "fixIncorrectScrollViewStateUpdateOnAndroid"); flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid(); fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue; @@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(19, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); + markFlagAsAccessed(20, "fixMappingOfEventPrioritiesBetweenFabricAndReact"); flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact(); fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue; @@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMissedFabricStateUpdatesOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(20, "fixMissedFabricStateUpdatesOnAndroid"); + markFlagAsAccessed(21, "fixMissedFabricStateUpdatesOnAndroid"); flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid(); fixMissedFabricStateUpdatesOnAndroid_ = flagValue; @@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(21, "forceBatchingMountItemsOnAndroid"); + markFlagAsAccessed(22, "forceBatchingMountItemsOnAndroid"); flagValue = currentProvider_->forceBatchingMountItemsOnAndroid(); forceBatchingMountItemsOnAndroid_ = flagValue; @@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(22, "fuseboxEnabledDebug"); + markFlagAsAccessed(23, "fuseboxEnabledDebug"); flagValue = currentProvider_->fuseboxEnabledDebug(); fuseboxEnabledDebug_ = flagValue; @@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(23, "fuseboxEnabledRelease"); + markFlagAsAccessed(24, "fuseboxEnabledRelease"); flagValue = currentProvider_->fuseboxEnabledRelease(); fuseboxEnabledRelease_ = flagValue; @@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(24, "initEagerTurboModulesOnNativeModulesQueueAndroid"); + markFlagAsAccessed(25, "initEagerTurboModulesOnNativeModulesQueueAndroid"); flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid(); initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue; @@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(25, "lazyAnimationCallbacks"); + markFlagAsAccessed(26, "lazyAnimationCallbacks"); flagValue = currentProvider_->lazyAnimationCallbacks(); lazyAnimationCallbacks_ = flagValue; @@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(26, "loadVectorDrawablesOnImages"); + markFlagAsAccessed(27, "loadVectorDrawablesOnImages"); flagValue = currentProvider_->loadVectorDrawablesOnImages(); loadVectorDrawablesOnImages_ = flagValue; @@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(27, "setAndroidLayoutDirection"); + markFlagAsAccessed(28, "setAndroidLayoutDirection"); flagValue = currentProvider_->setAndroidLayoutDirection(); setAndroidLayoutDirection_ = flagValue; @@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless() // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(28, "useImmediateExecutorInAndroidBridgeless"); + markFlagAsAccessed(29, "useImmediateExecutorInAndroidBridgeless"); flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless(); useImmediateExecutorInAndroidBridgeless_ = flagValue; @@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(29, "useModernRuntimeScheduler"); + markFlagAsAccessed(30, "useModernRuntimeScheduler"); flagValue = currentProvider_->useModernRuntimeScheduler(); useModernRuntimeScheduler_ = flagValue; @@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(30, "useNativeViewConfigsInBridgelessMode"); + markFlagAsAccessed(31, "useNativeViewConfigsInBridgelessMode"); flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode(); useNativeViewConfigsInBridgelessMode_ = flagValue; @@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::useNewReactImageViewBackgroundDrawing() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(31, "useNewReactImageViewBackgroundDrawing"); + markFlagAsAccessed(32, "useNewReactImageViewBackgroundDrawing"); flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing(); useNewReactImageViewBackgroundDrawing_ = flagValue; @@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(32, "useOptimisedViewPreallocationOnAndroid"); + markFlagAsAccessed(33, "useOptimisedViewPreallocationOnAndroid"); flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid(); useOptimisedViewPreallocationOnAndroid_ = flagValue; @@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(33, "useRuntimeShadowNodeReferenceUpdate"); + markFlagAsAccessed(34, "useRuntimeShadowNodeReferenceUpdate"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate(); useRuntimeShadowNodeReferenceUpdate_ = flagValue; @@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(34, "useRuntimeShadowNodeReferenceUpdateOnLayout"); + markFlagAsAccessed(35, "useRuntimeShadowNodeReferenceUpdateOnLayout"); flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout(); useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue; @@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() { // be accessing the provider multiple times but the end state of this // instance and the returned flag value would be the same. - markFlagAsAccessed(35, "useStateAlignmentMechanism"); + markFlagAsAccessed(36, "useStateAlignmentMechanism"); flagValue = currentProvider_->useStateAlignmentMechanism(); useStateAlignmentMechanism_ = flagValue; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h index 2aab5e4621121b..54428c4e02832e 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsAccessor.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<8efbce21aeb4cd838f324264514b3e68>> + * @generated SignedSource<<7ccbfca232e82bbaea291d16a011d268>> */ /** @@ -39,6 +39,7 @@ class ReactNativeFeatureFlagsAccessor { bool completeReactInstanceCreationOnBgThreadOnAndroid(); bool destroyFabricSurfacesInReactInstanceManager(); bool enableAlignItemsBaselineOnFabricIOS(); + bool enableBridgelessArchitecture(); bool enableCleanTextInputYogaNode(); bool enableFabricRendererExclusively(); bool enableGranularShadowTreeStateReconciliation(); @@ -77,7 +78,7 @@ class ReactNativeFeatureFlagsAccessor { std::unique_ptr currentProvider_; bool wasOverridden_; - std::array, 36> accessedFeatureFlags_; + std::array, 37> accessedFeatureFlags_; std::atomic> commonTestFlag_; std::atomic> allowCollapsableChildren_; @@ -87,6 +88,7 @@ class ReactNativeFeatureFlagsAccessor { std::atomic> completeReactInstanceCreationOnBgThreadOnAndroid_; std::atomic> destroyFabricSurfacesInReactInstanceManager_; std::atomic> enableAlignItemsBaselineOnFabricIOS_; + std::atomic> enableBridgelessArchitecture_; std::atomic> enableCleanTextInputYogaNode_; std::atomic> enableFabricRendererExclusively_; std::atomic> enableGranularShadowTreeStateReconciliation_; diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h index c815ee281961f3..56c2fdf780f3bc 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsDefaults.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<6daf5bdb8e3cfc2b8ea36dcb9c585ddf>> */ /** @@ -59,6 +59,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider { return true; } + bool enableBridgelessArchitecture() override { + return false; + } + bool enableCleanTextInputYogaNode() override { return false; } diff --git a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h index a898b67220fda0..d26fae7ddcf7db 100644 --- a/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h +++ b/packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlagsProvider.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<94368075120ed69155513392a88f8547>> */ /** @@ -33,6 +33,7 @@ class ReactNativeFeatureFlagsProvider { virtual bool completeReactInstanceCreationOnBgThreadOnAndroid() = 0; virtual bool destroyFabricSurfacesInReactInstanceManager() = 0; virtual bool enableAlignItemsBaselineOnFabricIOS() = 0; + virtual bool enableBridgelessArchitecture() = 0; virtual bool enableCleanTextInputYogaNode() = 0; virtual bool enableFabricRendererExclusively() = 0; virtual bool enableGranularShadowTreeStateReconciliation() = 0; diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp index acaa66a8c5d60f..c52a17b85f5b87 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.cpp @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<> */ /** @@ -77,6 +77,11 @@ bool NativeReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS( return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(); } +bool NativeReactNativeFeatureFlags::enableBridgelessArchitecture( + jsi::Runtime& /*runtime*/) { + return ReactNativeFeatureFlags::enableBridgelessArchitecture(); +} + bool NativeReactNativeFeatureFlags::enableCleanTextInputYogaNode( jsi::Runtime& /*runtime*/) { return ReactNativeFeatureFlags::enableCleanTextInputYogaNode(); diff --git a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h index 0c1065fea97515..b4e6605ef78e87 100644 --- a/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h +++ b/packages/react-native/ReactCommon/react/nativemodule/featureflags/NativeReactNativeFeatureFlags.h @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<> + * @generated SignedSource<<7bf53962c66470abe38b2e4d4721223d>> */ /** @@ -51,6 +51,8 @@ class NativeReactNativeFeatureFlags bool enableAlignItemsBaselineOnFabricIOS(jsi::Runtime& runtime); + bool enableBridgelessArchitecture(jsi::Runtime& runtime); + bool enableCleanTextInputYogaNode(jsi::Runtime& runtime); bool enableFabricRendererExclusively(jsi::Runtime& runtime); diff --git a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js index 07a40d414f33d4..d8b33e306a60ed 100644 --- a/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js +++ b/packages/react-native/scripts/featureflags/ReactNativeFeatureFlags.config.js @@ -74,6 +74,11 @@ const definitions: FeatureFlagDefinitions = { description: 'Kill-switch to turn off support for aling-items:baseline on Fabric iOS.', }, + enableBridgelessArchitecture: { + defaultValue: false, + description: + 'Enables the Bridgeless Architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer`', + }, enableCleanTextInputYogaNode: { defaultValue: false, description: 'Clean yoga node when does not change.', diff --git a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js index 9acb453ac20c21..7fa0858f0b4438 100644 --- a/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/ReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<1f55fc80f2d20514a341988b4f938ac5>> + * @generated SignedSource<<1b9bc796b7da6ead051b7e8e2d74d575>> * @flow strict-local */ @@ -51,6 +51,7 @@ export type ReactNativeFeatureFlags = { completeReactInstanceCreationOnBgThreadOnAndroid: Getter, destroyFabricSurfacesInReactInstanceManager: Getter, enableAlignItemsBaselineOnFabricIOS: Getter, + enableBridgelessArchitecture: Getter, enableCleanTextInputYogaNode: Getter, enableFabricRendererExclusively: Getter, enableGranularShadowTreeStateReconciliation: Getter, @@ -168,6 +169,10 @@ export const destroyFabricSurfacesInReactInstanceManager: Getter = crea * Kill-switch to turn off support for aling-items:baseline on Fabric iOS. */ export const enableAlignItemsBaselineOnFabricIOS: Getter = createNativeFlagGetter('enableAlignItemsBaselineOnFabricIOS', true); +/** + * Enables the Bridgeless Architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer` + */ +export const enableBridgelessArchitecture: Getter = createNativeFlagGetter('enableBridgelessArchitecture', false); /** * Clean yoga node when does not change. */ diff --git a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js index eac76643f5c934..e79ec3cdca49b3 100644 --- a/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +++ b/packages/react-native/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js @@ -4,7 +4,7 @@ * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * - * @generated SignedSource<<0ee6343505e52cde7930a31ab5c8218a>> + * @generated SignedSource<<79be648aed6a479c33a65827485b20f3>> * @flow strict-local */ @@ -31,6 +31,7 @@ export interface Spec extends TurboModule { +completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean; +destroyFabricSurfacesInReactInstanceManager?: () => boolean; +enableAlignItemsBaselineOnFabricIOS?: () => boolean; + +enableBridgelessArchitecture?: () => boolean; +enableCleanTextInputYogaNode?: () => boolean; +enableFabricRendererExclusively?: () => boolean; +enableGranularShadowTreeStateReconciliation?: () => boolean;