Skip to content

Commit 8e5ead8

Browse files
committed
Add per-platform redBoxV2 feature flags
Summary: Add `redBoxV2IOS` and `redBoxV2Android` common feature flags (default false), gating RedBox 2.0 independently on each platform. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D98115369 fbshipit-source-id: b4e80c24d22fc604df86c0be042cea57ca0de015
1 parent 5e3a3ba commit 8e5ead8

20 files changed

Lines changed: 273 additions & 39 deletions

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlags.kt

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<156d4f5f35037184b6fc61ff1d856028>>
7+
* @generated SignedSource<<fb10ba0f792d84448e791ca6b744e6f3>>
88
*/
99

1010
/**
@@ -426,6 +426,18 @@ public object ReactNativeFeatureFlags {
426426
@JvmStatic
427427
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
428428

429+
/**
430+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
431+
*/
432+
@JvmStatic
433+
public fun redBoxV2Android(): Boolean = accessor.redBoxV2Android()
434+
435+
/**
436+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
437+
*/
438+
@JvmStatic
439+
public fun redBoxV2IOS(): Boolean = accessor.redBoxV2IOS()
440+
429441
/**
430442
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
431443
*/

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxAccessor.kt

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0875d5e54d884a26d37bb4eb2acc57d5>>
7+
* @generated SignedSource<<a9911f49da9cbc9200c981e10270d4c5>>
88
*/
99

1010
/**
@@ -86,6 +86,8 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8686
private var perfMonitorV2EnabledCache: Boolean? = null
8787
private var preparedTextCacheSizeCache: Double? = null
8888
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
89+
private var redBoxV2AndroidCache: Boolean? = null
90+
private var redBoxV2IOSCache: Boolean? = null
8991
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
9092
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9193
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -700,6 +702,24 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
700702
return cached
701703
}
702704

705+
override fun redBoxV2Android(): Boolean {
706+
var cached = redBoxV2AndroidCache
707+
if (cached == null) {
708+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2Android()
709+
redBoxV2AndroidCache = cached
710+
}
711+
return cached
712+
}
713+
714+
override fun redBoxV2IOS(): Boolean {
715+
var cached = redBoxV2IOSCache
716+
if (cached == null) {
717+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2IOS()
718+
redBoxV2IOSCache = cached
719+
}
720+
return cached
721+
}
722+
703723
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
704724
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
705725
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsCxxInterop.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<948a9beebe2ff00791a03455eb774eee>>
7+
* @generated SignedSource<<0c49d0a7595b0b5cbd064e4fab4e83fd>>
88
*/
99

1010
/**
@@ -160,6 +160,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
160160

161161
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
162162

163+
@DoNotStrip @JvmStatic public external fun redBoxV2Android(): Boolean
164+
165+
@DoNotStrip @JvmStatic public external fun redBoxV2IOS(): Boolean
166+
163167
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
164168

165169
@DoNotStrip @JvmStatic public external fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsDefaults.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<89c61520177334f93c65ff92c2fc74a6>>
7+
* @generated SignedSource<<37a4d34a4c5e6d2002b0870d45e9c5c7>>
88
*/
99

1010
/**
@@ -155,6 +155,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
155155

156156
override fun preventShadowTreeCommitExhaustion(): Boolean = false
157157

158+
override fun redBoxV2Android(): Boolean = false
159+
160+
override fun redBoxV2IOS(): Boolean = false
161+
158162
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
159163

160164
override fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean = false

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsLocalAccessor.kt

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<669708c311abe9ffc8f7783219e2baad>>
7+
* @generated SignedSource<<06283f7293ad5a6ef6fca7e27cbb96f7>>
88
*/
99

1010
/**
@@ -90,6 +90,8 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9090
private var perfMonitorV2EnabledCache: Boolean? = null
9191
private var preparedTextCacheSizeCache: Double? = null
9292
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
93+
private var redBoxV2AndroidCache: Boolean? = null
94+
private var redBoxV2IOSCache: Boolean? = null
9395
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
9496
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9597
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -770,6 +772,26 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
770772
return cached
771773
}
772774

775+
override fun redBoxV2Android(): Boolean {
776+
var cached = redBoxV2AndroidCache
777+
if (cached == null) {
778+
cached = currentProvider.redBoxV2Android()
779+
accessedFeatureFlags.add("redBoxV2Android")
780+
redBoxV2AndroidCache = cached
781+
}
782+
return cached
783+
}
784+
785+
override fun redBoxV2IOS(): Boolean {
786+
var cached = redBoxV2IOSCache
787+
if (cached == null) {
788+
cached = currentProvider.redBoxV2IOS()
789+
accessedFeatureFlags.add("redBoxV2IOS")
790+
redBoxV2IOSCache = cached
791+
}
792+
return cached
793+
}
794+
773795
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
774796
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
775797
if (cached == null) {

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/internal/featureflags/ReactNativeFeatureFlagsProvider.kt

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<db06b64a8d1b9ab99b368fea41185d62>>
7+
* @generated SignedSource<<ac5df245d85541b8ee07225d53115879>>
88
*/
99

1010
/**
@@ -155,6 +155,10 @@ public interface ReactNativeFeatureFlagsProvider {
155155

156156
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
157157

158+
@DoNotStrip public fun redBoxV2Android(): Boolean
159+
160+
@DoNotStrip public fun redBoxV2IOS(): Boolean
161+
158162
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
159163

160164
@DoNotStrip public fun shouldTriggerResponderTransferOnScrollAndroid(): Boolean

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.cpp

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0b95d68522d63d51d3e524aeecff246a>>
7+
* @generated SignedSource<<2960f980bfbeed928a109e4e596a93ec>>
88
*/
99

1010
/**
@@ -435,6 +435,18 @@ class ReactNativeFeatureFlagsJavaProvider
435435
return method(javaProvider_);
436436
}
437437

438+
bool redBoxV2Android() override {
439+
static const auto method =
440+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2Android");
441+
return method(javaProvider_);
442+
}
443+
444+
bool redBoxV2IOS() override {
445+
static const auto method =
446+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2IOS");
447+
return method(javaProvider_);
448+
}
449+
438450
bool shouldPressibilityUseW3CPointerEventsForHover() override {
439451
static const auto method =
440452
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -883,6 +895,16 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
883895
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
884896
}
885897

898+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2Android(
899+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
900+
return ReactNativeFeatureFlags::redBoxV2Android();
901+
}
902+
903+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS(
904+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
905+
return ReactNativeFeatureFlags::redBoxV2IOS();
906+
}
907+
886908
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
887909
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
888910
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -1207,6 +1229,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12071229
makeNativeMethod(
12081230
"preventShadowTreeCommitExhaustion",
12091231
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
1232+
makeNativeMethod(
1233+
"redBoxV2Android",
1234+
JReactNativeFeatureFlagsCxxInterop::redBoxV2Android),
1235+
makeNativeMethod(
1236+
"redBoxV2IOS",
1237+
JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS),
12101238
makeNativeMethod(
12111239
"shouldPressibilityUseW3CPointerEventsForHover",
12121240
JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover),

packages/react-native/ReactAndroid/src/main/jni/react/featureflags/JReactNativeFeatureFlagsCxxInterop.h

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<6b7e2af51ba9d64ae4e474dfa104a7c3>>
7+
* @generated SignedSource<<2b5ee310ae035b946a9c1499cb6795f9>>
88
*/
99

1010
/**
@@ -228,6 +228,12 @@ class JReactNativeFeatureFlagsCxxInterop
228228
static bool preventShadowTreeCommitExhaustion(
229229
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
230230

231+
static bool redBoxV2Android(
232+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
233+
234+
static bool redBoxV2IOS(
235+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
236+
231237
static bool shouldPressibilityUseW3CPointerEventsForHover(
232238
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
233239

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<08a361f2ffac6a0496adac1d4c3e4726>>
7+
* @generated SignedSource<<c650baa3dc511310aad1125ea96cd35f>>
88
*/
99

1010
/**
@@ -290,6 +290,14 @@ bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
290290
return getAccessor().preventShadowTreeCommitExhaustion();
291291
}
292292

293+
bool ReactNativeFeatureFlags::redBoxV2Android() {
294+
return getAccessor().redBoxV2Android();
295+
}
296+
297+
bool ReactNativeFeatureFlags::redBoxV2IOS() {
298+
return getAccessor().redBoxV2IOS();
299+
}
300+
293301
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
294302
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
295303
}

packages/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.h

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* This source code is licensed under the MIT license found in the
55
* LICENSE file in the root directory of this source tree.
66
*
7-
* @generated SignedSource<<0bbe4d41581432dfad7adbc2db133d00>>
7+
* @generated SignedSource<<124bb3aa9b7795df019e14d3b8212166>>
88
*/
99

1010
/**
@@ -369,6 +369,16 @@ class ReactNativeFeatureFlags {
369369
*/
370370
RN_EXPORT static bool preventShadowTreeCommitExhaustion();
371371

372+
/**
373+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
374+
*/
375+
RN_EXPORT static bool redBoxV2Android();
376+
377+
/**
378+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
379+
*/
380+
RN_EXPORT static bool redBoxV2IOS();
381+
372382
/**
373383
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
374384
*/

0 commit comments

Comments
 (0)