Skip to content

Commit d6ed561

Browse files
motiz88meta-codesync[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 fbshipit-source-id: b4e80c24d22fc604df86c0be042cea57ca0de015
1 parent fed907b commit d6ed561

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<<4ee7b2e0a88bc5087e0739658810dee5>>
7+
* @generated SignedSource<<82da59cbfb06937bba284ff1df2c64d6>>
88
*/
99

1010
/**
@@ -450,6 +450,18 @@ public object ReactNativeFeatureFlags {
450450
@JvmStatic
451451
public fun preventShadowTreeCommitExhaustion(): Boolean = accessor.preventShadowTreeCommitExhaustion()
452452

453+
/**
454+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
455+
*/
456+
@JvmStatic
457+
public fun redBoxV2Android(): Boolean = accessor.redBoxV2Android()
458+
459+
/**
460+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
461+
*/
462+
@JvmStatic
463+
public fun redBoxV2IOS(): Boolean = accessor.redBoxV2IOS()
464+
453465
/**
454466
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
455467
*/

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<<87405910d0abf422badc45d1510ad702>>
7+
* @generated SignedSource<<b6d6b8aae3449760d857e5dd52588b03>>
88
*/
99

1010
/**
@@ -90,6 +90,8 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
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
@@ -741,6 +743,24 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
741743
return cached
742744
}
743745

746+
override fun redBoxV2Android(): Boolean {
747+
var cached = redBoxV2AndroidCache
748+
if (cached == null) {
749+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2Android()
750+
redBoxV2AndroidCache = cached
751+
}
752+
return cached
753+
}
754+
755+
override fun redBoxV2IOS(): Boolean {
756+
var cached = redBoxV2IOSCache
757+
if (cached == null) {
758+
cached = ReactNativeFeatureFlagsCxxInterop.redBoxV2IOS()
759+
redBoxV2IOSCache = cached
760+
}
761+
return cached
762+
}
763+
744764
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
745765
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
746766
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<<c0f1210cabc66cc1b3fdbf8473d1df11>>
7+
* @generated SignedSource<<7ca56a7b519e6e1619931447dcc1672a>>
88
*/
99

1010
/**
@@ -168,6 +168,10 @@ public object ReactNativeFeatureFlagsCxxInterop {
168168

169169
@DoNotStrip @JvmStatic public external fun preventShadowTreeCommitExhaustion(): Boolean
170170

171+
@DoNotStrip @JvmStatic public external fun redBoxV2Android(): Boolean
172+
173+
@DoNotStrip @JvmStatic public external fun redBoxV2IOS(): Boolean
174+
171175
@DoNotStrip @JvmStatic public external fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
172176

173177
@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<<73ce7f74a1fc0843a91d2fe11615b333>>
7+
* @generated SignedSource<<fe424de3f03b5f2ee20b83896eef01b1>>
88
*/
99

1010
/**
@@ -163,6 +163,10 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
163163

164164
override fun preventShadowTreeCommitExhaustion(): Boolean = false
165165

166+
override fun redBoxV2Android(): Boolean = false
167+
168+
override fun redBoxV2IOS(): Boolean = false
169+
166170
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean = false
167171

168172
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<<a070acdbab967adb2c8c81e9e89b8636>>
7+
* @generated SignedSource<<0de759cf10c9d77c9938f9dac257aada>>
88
*/
99

1010
/**
@@ -94,6 +94,8 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
9494
private var perfMonitorV2EnabledCache: Boolean? = null
9595
private var preparedTextCacheSizeCache: Double? = null
9696
private var preventShadowTreeCommitExhaustionCache: Boolean? = null
97+
private var redBoxV2AndroidCache: Boolean? = null
98+
private var redBoxV2IOSCache: Boolean? = null
9799
private var shouldPressibilityUseW3CPointerEventsForHoverCache: Boolean? = null
98100
private var shouldTriggerResponderTransferOnScrollAndroidCache: Boolean? = null
99101
private var skipActivityIdentityAssertionOnHostPauseCache: Boolean? = null
@@ -815,6 +817,26 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
815817
return cached
816818
}
817819

820+
override fun redBoxV2Android(): Boolean {
821+
var cached = redBoxV2AndroidCache
822+
if (cached == null) {
823+
cached = currentProvider.redBoxV2Android()
824+
accessedFeatureFlags.add("redBoxV2Android")
825+
redBoxV2AndroidCache = cached
826+
}
827+
return cached
828+
}
829+
830+
override fun redBoxV2IOS(): Boolean {
831+
var cached = redBoxV2IOSCache
832+
if (cached == null) {
833+
cached = currentProvider.redBoxV2IOS()
834+
accessedFeatureFlags.add("redBoxV2IOS")
835+
redBoxV2IOSCache = cached
836+
}
837+
return cached
838+
}
839+
818840
override fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean {
819841
var cached = shouldPressibilityUseW3CPointerEventsForHoverCache
820842
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<<2de065dd6f726ad92376e2385e134c7e>>
7+
* @generated SignedSource<<dd7ae1c5f86fa273402e5b64a8636528>>
88
*/
99

1010
/**
@@ -163,6 +163,10 @@ public interface ReactNativeFeatureFlagsProvider {
163163

164164
@DoNotStrip public fun preventShadowTreeCommitExhaustion(): Boolean
165165

166+
@DoNotStrip public fun redBoxV2Android(): Boolean
167+
168+
@DoNotStrip public fun redBoxV2IOS(): Boolean
169+
166170
@DoNotStrip public fun shouldPressibilityUseW3CPointerEventsForHover(): Boolean
167171

168172
@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<<2c9c4c2ef57882df723930daa933afd8>>
7+
* @generated SignedSource<<411aef7b1b977407b52e4f23e95db0a5>>
88
*/
99

1010
/**
@@ -459,6 +459,18 @@ class ReactNativeFeatureFlagsJavaProvider
459459
return method(javaProvider_);
460460
}
461461

462+
bool redBoxV2Android() override {
463+
static const auto method =
464+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2Android");
465+
return method(javaProvider_);
466+
}
467+
468+
bool redBoxV2IOS() override {
469+
static const auto method =
470+
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("redBoxV2IOS");
471+
return method(javaProvider_);
472+
}
473+
462474
bool shouldPressibilityUseW3CPointerEventsForHover() override {
463475
static const auto method =
464476
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("shouldPressibilityUseW3CPointerEventsForHover");
@@ -933,6 +945,16 @@ bool JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion(
933945
return ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion();
934946
}
935947

948+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2Android(
949+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
950+
return ReactNativeFeatureFlags::redBoxV2Android();
951+
}
952+
953+
bool JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS(
954+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
955+
return ReactNativeFeatureFlags::redBoxV2IOS();
956+
}
957+
936958
bool JReactNativeFeatureFlagsCxxInterop::shouldPressibilityUseW3CPointerEventsForHover(
937959
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
938960
return ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover();
@@ -1274,6 +1296,12 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
12741296
makeNativeMethod(
12751297
"preventShadowTreeCommitExhaustion",
12761298
JReactNativeFeatureFlagsCxxInterop::preventShadowTreeCommitExhaustion),
1299+
makeNativeMethod(
1300+
"redBoxV2Android",
1301+
JReactNativeFeatureFlagsCxxInterop::redBoxV2Android),
1302+
makeNativeMethod(
1303+
"redBoxV2IOS",
1304+
JReactNativeFeatureFlagsCxxInterop::redBoxV2IOS),
12771305
makeNativeMethod(
12781306
"shouldPressibilityUseW3CPointerEventsForHover",
12791307
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<<d27bc9bf87498e16dff7eac56d52b9d1>>
7+
* @generated SignedSource<<7b397abbf52289b37f424eef8e689cc8>>
88
*/
99

1010
/**
@@ -240,6 +240,12 @@ class JReactNativeFeatureFlagsCxxInterop
240240
static bool preventShadowTreeCommitExhaustion(
241241
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
242242

243+
static bool redBoxV2Android(
244+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
245+
246+
static bool redBoxV2IOS(
247+
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
248+
243249
static bool shouldPressibilityUseW3CPointerEventsForHover(
244250
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
245251

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<<eb31174e5f1e3f37503fe5c910a6b6c8>>
7+
* @generated SignedSource<<505f532777eb5c18637f61b824600234>>
88
*/
99

1010
/**
@@ -306,6 +306,14 @@ bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
306306
return getAccessor().preventShadowTreeCommitExhaustion();
307307
}
308308

309+
bool ReactNativeFeatureFlags::redBoxV2Android() {
310+
return getAccessor().redBoxV2Android();
311+
}
312+
313+
bool ReactNativeFeatureFlags::redBoxV2IOS() {
314+
return getAccessor().redBoxV2IOS();
315+
}
316+
309317
bool ReactNativeFeatureFlags::shouldPressibilityUseW3CPointerEventsForHover() {
310318
return getAccessor().shouldPressibilityUseW3CPointerEventsForHover();
311319
}

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<<d9e55ee2af90103f57394e9683a0ac16>>
7+
* @generated SignedSource<<ec9479d555f4e08095fbde0bfd09c479>>
88
*/
99

1010
/**
@@ -389,6 +389,16 @@ class ReactNativeFeatureFlags {
389389
*/
390390
RN_EXPORT static bool preventShadowTreeCommitExhaustion();
391391

392+
/**
393+
* Use the redesigned RedBox error overlay on Android, styled to match the LogBox visual language.
394+
*/
395+
RN_EXPORT static bool redBoxV2Android();
396+
397+
/**
398+
* Use the redesigned RedBox error overlay on iOS, styled to match the LogBox visual language.
399+
*/
400+
RN_EXPORT static bool redBoxV2IOS();
401+
392402
/**
393403
* Function used to enable / disable Pressibility from using W3C Pointer Events for its hover callbacks
394404
*/

0 commit comments

Comments
 (0)