From 0705eb8b91b6c3688a73f8481c6b067899ac6eec Mon Sep 17 00:00:00 2001 From: David Vacca Date: Mon, 28 Oct 2024 14:23:51 -0700 Subject: [PATCH] Assert FeatureFlags in Bridgeless initialization only on Debug mode (#47263) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/47263 Assert FeatureFlags in Bridgeless initialization only on Debug mode changelog: [internal] internal Reviewed By: shwanton Differential Revision: D65078365 fbshipit-source-id: 79a40ba84e140b9784660ac9d1c14fd0f7426653 --- .../facebook/react/runtime/ReactHostImpl.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java index b9fc10da9d0705..98806deba22e67 100644 --- a/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java +++ b/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.java @@ -923,17 +923,19 @@ private Task getOrCreateStartTask() { final String method = "getOrCreateStartTask()"; if (mStartTask == null) { log(method, "Schedule"); - Assertions.assertCondition( - ReactNativeFeatureFlags.enableBridgelessArchitecture(), - "enableBridgelessArchitecture FeatureFlag must be set to start ReactNative."); + if (ReactBuildConfig.DEBUG) { + Assertions.assertCondition( + ReactNativeFeatureFlags.enableBridgelessArchitecture(), + "enableBridgelessArchitecture FeatureFlag must be set to start ReactNative."); - Assertions.assertCondition( - ReactNativeFeatureFlags.enableFabricRenderer(), - "enableFabricRenderer FeatureFlag must be set to start ReactNative."); + Assertions.assertCondition( + ReactNativeFeatureFlags.enableFabricRenderer(), + "enableFabricRenderer FeatureFlag must be set to start ReactNative."); - Assertions.assertCondition( - ReactNativeFeatureFlags.useTurboModules(), - "useTurboModules FeatureFlag must be set to start ReactNative."); + Assertions.assertCondition( + ReactNativeFeatureFlags.useTurboModules(), + "useTurboModules FeatureFlag must be set to start ReactNative."); + } mStartTask = waitThenCallGetOrCreateReactInstanceTask() .continueWithTask(