Skip to content

Commit eec4ba4

Browse files
motiz88facebook-github-bot
authored andcommitted
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
1 parent cb78dbc commit eec4ba4

20 files changed

Lines changed: 274 additions & 40 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<<99a7d3e814f4b037ed4496b6eee4f264>>
7+
* @generated SignedSource<<45d368406f020ca101d9b87c7e2527b1>>
88
*/
99

1010
/**
@@ -444,6 +444,18 @@ public object ReactNativeFeatureFlags {
444444
@JvmStatic
445445
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
446446

447+
/**
448+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
449+
*/
450+
@JvmStatic
451+
public fun redBoxV2Android(): Boolean = accessor.redBoxV2Android()
452+
453+
/**
454+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
455+
*/
456+
@JvmStatic
457+
public fun redBoxV2IOS(): Boolean = accessor.redBoxV2IOS()
458+
447459
/**
448460
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
449461
*/

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<<c2f867597d97dc97c8ded5fbd258c13c>>
7+
* @generated SignedSource<<5bb0640a99befcfcb3a197a5a074513f>>
88
*/
99

1010
/**
@@ -89,6 +89,8 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
8989
private var perfMonitorV2EnabledCache: Boolean? = null
9090
private var preparedTextCacheSizeCache: Double? = null
9191
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
92+
private var redBoxV2AndroidCache: Boolean? = null
93+
private var redBoxV2IOSCache: Boolean? = null
9294
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
9395
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
9496
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -731,6 +733,24 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
731733
return cached
732734
}
733735

736+
override fun redBoxV2Android(): Boolean {
737+
var cached = redBoxV2AndroidCache
738+
if (cached == null) {
739+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2Android()
740+
redBoxV2AndroidCache = cached
741+
}
742+
return cached
743+
}
744+
745+
override fun redBoxV2IOS(): Boolean {
746+
var cached = redBoxV2IOSCache
747+
if (cached == null) {
748+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2IOS()
749+
redBoxV2IOSCache = cached
750+
}
751+
return cached
752+
}
753+
734754
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
735755
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
736756
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<<8667d7237cea82bb5978cb19582d59c0>>
7+
* @generated SignedSource<<23c20167823efb1df8209cdffa7a23d0>>
88
*/
99

1010
/**
@@ -166,6 +166,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
166166

167167
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
168168

169+
@DoNotStrip @JvmStatic public external fun redBoxV2Android(): Boolean
170+
171+
@DoNotStrip @JvmStatic public external fun redBoxV2IOS(): Boolean
172+
169173
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
170174

171175
@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<<17abc72a4045c5695818f254be1783b5>>
7+
* @generated SignedSource<<b90bd36b587f5737a3348a3785d2757e>>
88
*/
99

1010
/**
@@ -161,6 +161,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
161161

162162
override fun preventShadowTreeCommitExhaustion(): Boolean = false
163163

164+
override fun redBoxV2Android(): Boolean = false
165+
166+
override fun redBoxV2IOS(): Boolean = false
167+
164168
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
165169

166170
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<<77ba6c5db120016e6e1f8af195ab3690>>
7+
* @generated SignedSource<<7d3853cb7e319830aab97792e1520ff7>>
88
*/
99

1010
/**
@@ -93,6 +93,8 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9393
private var perfMonitorV2EnabledCache: Boolean? = null
9494
private var preparedTextCacheSizeCache: Double? = null
9595
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
96+
private var redBoxV2AndroidCache: Boolean? = null
97+
private var redBoxV2IOSCache: Boolean? = null
9698
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
9799
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
98100
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -804,6 +806,26 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
804806
return cached
805807
}
806808

809+
override fun redBoxV2Android(): Boolean {
810+
var cached = redBoxV2AndroidCache
811+
if (cached == null) {
812+
cached = currentProvider.redBoxV2Android()
813+
accessedFeatureFlags.add("redBoxV2Android")
814+
redBoxV2AndroidCache = cached
815+
}
816+
return cached
817+
}
818+
819+
override fun redBoxV2IOS(): Boolean {
820+
var cached = redBoxV2IOSCache
821+
if (cached == null) {
822+
cached = currentProvider.redBoxV2IOS()
823+
accessedFeatureFlags.add("redBoxV2IOS")
824+
redBoxV2IOSCache = cached
825+
}
826+
return cached
827+
}
828+
807829
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
808830
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
809831
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<<8496c138ce5493df84149940df0de944>>
7+
* @generated SignedSource<<dcd57ab69856d49cb56ae23b4bf256dc>>
88
*/
99

1010
/**
@@ -161,6 +161,10 @@ public interface ReactNativeFeatureFlagsProvider {
161161

162162
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
163163

164+
@DoNotStrip public fun redBoxV2Android(): Boolean
165+
166+
@DoNotStrip public fun redBoxV2IOS(): Boolean
167+
164168
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
165169

166170
@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<<5bac13bb6faeffdd3c5eca800f25b96a>>
7+
* @generated SignedSource<<eb382be7051566f63489b990a8d811f4>>
88
*/
99

1010
/**
@@ -453,6 +453,18 @@ class ReactNativeFeatureFlagsJavaProvider
453453
return method(javaProvider_);
454454
}
455455

456+
bool redBoxV2Android() override {
457+
static const auto method =
458+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2Android");
459+
return method(javaProvider_);
460+
}
461+
462+
bool redBoxV2IOS() override {
463+
static const auto method =
464+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2IOS");
465+
return method(javaProvider_);
466+
}
467+
456468
bool shouldPressibilityUseW3CPointerEventsForHover() override {
457469
static const auto method =
458470
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -922,6 +934,16 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
922934
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
923935
}
924936

937+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2Android(
938+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
939+
return ReactNativeFeatureFlags::redBoxV2Android();
940+
}
941+
942+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS(
943+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
944+
return ReactNativeFeatureFlags::redBoxV2IOS();
945+
}
946+
925947
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
926948
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
927949
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -1260,6 +1282,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12601282
makeNativeMethod(
12611283
"preventShadowTreeCommitExhaustion",
12621284
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
1285+
makeNativeMethod(
1286+
"redBoxV2Android",
1287+
JReactNativeFeatureFlagsCxxInterop::redBoxV2Android),
1288+
makeNativeMethod(
1289+
"redBoxV2IOS",
1290+
JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS),
12631291
makeNativeMethod(
12641292
"shouldPressibilityUseW3CPointerEventsForHover",
12651293
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<<ad45dce1fafd3bd29078bd54e4206d9f>>
7+
* @generated SignedSource<<c565fa1c5c2ca5fb9e0f23f103d27b43>>
88
*/
99

1010
/**
@@ -237,6 +237,12 @@ class JReactNativeFeatureFlagsCxxInterop
237237
static bool preventShadowTreeCommitExhaustion(
238238
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
239239

240+
static bool redBoxV2Android(
241+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
242+
243+
static bool redBoxV2IOS(
244+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
245+
240246
static bool shouldPressibilityUseW3CPointerEventsForHover(
241247
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
242248

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<<b229243317998e64843f285f86af161c>>
7+
* @generated SignedSource<<211e6d3081b5fc5e5b30e87f04970e95>>
88
*/
99

1010
/**
@@ -302,6 +302,14 @@ bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
302302
return getAccessor().preventShadowTreeCommitExhaustion();
303303
}
304304

305+
bool ReactNativeFeatureFlags::redBoxV2Android() {
306+
return getAccessor().redBoxV2Android();
307+
}
308+
309+
bool ReactNativeFeatureFlags::redBoxV2IOS() {
310+
return getAccessor().redBoxV2IOS();
311+
}
312+
305313
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
306314
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
307315
}

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<<86b3267ffa68e0f68280957aa54d5041>>
7+
* @generated SignedSource<<4adf6fb186eeb45234b8c1196e9a92c9>>
88
*/
99

1010
/**
@@ -384,6 +384,16 @@ class ReactNativeFeatureFlags {
384384
*/
385385
RN_EXPORT static bool preventShadowTreeCommitExhaustion();
386386

387+
/**
388+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
389+
*/
390+
RN_EXPORT static bool redBoxV2Android();
391+
392+
/**
393+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
394+
*/
395+
RN_EXPORT static bool redBoxV2IOS();
396+
387397
/**
388398
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
389399
*/

0 commit comments

Comments
 (0)