Enforce sorting of feature flag definitions (#43329)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/43329

Improve maintainability of this file, in particular reducing the probability of a merge conflict for new entries.

Changelog: [Internal]

Reviewed By: rubennorte

Differential Revision: D54539469

fbshipit-source-id: dc2fca42b4490d87c532b21043b0855d8d1a894d
This commit is contained in:
Alex Hunt
2024-03-05 17:27:23 -08:00
committed by Facebook GitHub Bot
parent 9aeb9f2f94
commit b5117520fc
19 changed files with 424 additions and 414 deletions
@@ -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<<c526fb1c44f00f5b032684396246e4d4>>
* @generated SignedSource<<6d6fd79bdd221b3aeed0057ac756ee92>>
*/
/**
@@ -34,24 +34,6 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun commonTestFlag(): Boolean = accessor.commonTestFlag()
/**
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
@JvmStatic
public fun enableBackgroundExecutor(): Boolean = accessor.enableBackgroundExecutor()
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
@JvmStatic
public fun useModernRuntimeScheduler(): Boolean = accessor.useModernRuntimeScheduler()
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
@JvmStatic
public fun enableMicrotasks(): Boolean = accessor.enableMicrotasks()
/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
@@ -59,10 +41,10 @@ public object ReactNativeFeatureFlags {
public fun batchRenderingUpdatesInEventLoop(): Boolean = accessor.batchRenderingUpdatesInEventLoop()
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
@JvmStatic
public fun enableSpannableBuildingUnification(): Boolean = accessor.enableSpannableBuildingUnification()
public fun enableBackgroundExecutor(): Boolean = accessor.enableBackgroundExecutor()
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
@@ -76,6 +58,18 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableFixForClippedSubviewsCrash(): Boolean = accessor.enableFixForClippedSubviewsCrash()
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
@JvmStatic
public fun enableMicrotasks(): Boolean = accessor.enableMicrotasks()
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
*/
@JvmStatic
public fun enableSpannableBuildingUnification(): Boolean = accessor.enableSpannableBuildingUnification()
/**
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
*/
@@ -88,6 +82,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun inspectorEnableModernCDPRegistry(): Boolean = accessor.inspectorEnableModernCDPRegistry()
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
@JvmStatic
public fun useModernRuntimeScheduler(): Boolean = accessor.useModernRuntimeScheduler()
/**
* Overrides the feature flags with the ones provided by the given provider
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
@@ -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<<11824621ee7ca5dbdf2f09bdf1a1f983>>
* @generated SignedSource<<45776de0416f833eed9bb84d6b7d1052>>
*/
/**
@@ -21,15 +21,15 @@ package com.facebook.react.internal.featureflags
public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccessor {
private var commonTestFlagCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var useModernRuntimeSchedulerCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var enableSpannableBuildingUnificationCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var enableCustomDrawOrderFabricCache: Boolean? = null
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var enableSpannableBuildingUnificationCache: Boolean? = null
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var useModernRuntimeSchedulerCache: Boolean? = null
override fun commonTestFlag(): Boolean {
var cached = commonTestFlagCache
@@ -40,33 +40,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableBackgroundExecutor(): Boolean {
var cached = enableBackgroundExecutorCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableBackgroundExecutor()
enableBackgroundExecutorCache = cached
}
return cached
}
override fun useModernRuntimeScheduler(): Boolean {
var cached = useModernRuntimeSchedulerCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.useModernRuntimeScheduler()
useModernRuntimeSchedulerCache = cached
}
return cached
}
override fun enableMicrotasks(): Boolean {
var cached = enableMicrotasksCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableMicrotasks()
enableMicrotasksCache = cached
}
return cached
}
override fun batchRenderingUpdatesInEventLoop(): Boolean {
var cached = batchRenderingUpdatesInEventLoopCache
if (cached == null) {
@@ -76,11 +49,11 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableSpannableBuildingUnification(): Boolean {
var cached = enableSpannableBuildingUnificationCache
override fun enableBackgroundExecutor(): Boolean {
var cached = enableBackgroundExecutorCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableSpannableBuildingUnification()
enableSpannableBuildingUnificationCache = cached
cached = ReactNativeFeatureFlagsCxxInterop.enableBackgroundExecutor()
enableBackgroundExecutorCache = cached
}
return cached
}
@@ -103,6 +76,24 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableMicrotasks(): Boolean {
var cached = enableMicrotasksCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableMicrotasks()
enableMicrotasksCache = cached
}
return cached
}
override fun enableSpannableBuildingUnification(): Boolean {
var cached = enableSpannableBuildingUnificationCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableSpannableBuildingUnification()
enableSpannableBuildingUnificationCache = cached
}
return cached
}
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean {
var cached = inspectorEnableCxxInspectorPackagerConnectionCache
if (cached == null) {
@@ -121,6 +112,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun useModernRuntimeScheduler(): Boolean {
var cached = useModernRuntimeSchedulerCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.useModernRuntimeScheduler()
useModernRuntimeSchedulerCache = cached
}
return cached
}
override fun override(provider: ReactNativeFeatureFlagsProvider): Unit =
ReactNativeFeatureFlagsCxxInterop.override(provider as Any)
@@ -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<<dfbe9bcab657e4c66dd104788639448d>>
* @generated SignedSource<<f9c16b18d93c786db2c5a90c0c4340f6>>
*/
/**
@@ -30,24 +30,24 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun commonTestFlag(): Boolean
@DoNotStrip @JvmStatic public external fun enableBackgroundExecutor(): Boolean
@DoNotStrip @JvmStatic public external fun useModernRuntimeScheduler(): Boolean
@DoNotStrip @JvmStatic public external fun enableMicrotasks(): Boolean
@DoNotStrip @JvmStatic public external fun batchRenderingUpdatesInEventLoop(): Boolean
@DoNotStrip @JvmStatic public external fun enableSpannableBuildingUnification(): Boolean
@DoNotStrip @JvmStatic public external fun enableBackgroundExecutor(): Boolean
@DoNotStrip @JvmStatic public external fun enableCustomDrawOrderFabric(): Boolean
@DoNotStrip @JvmStatic public external fun enableFixForClippedSubviewsCrash(): Boolean
@DoNotStrip @JvmStatic public external fun enableMicrotasks(): Boolean
@DoNotStrip @JvmStatic public external fun enableSpannableBuildingUnification(): Boolean
@DoNotStrip @JvmStatic public external fun inspectorEnableCxxInspectorPackagerConnection(): Boolean
@DoNotStrip @JvmStatic public external fun inspectorEnableModernCDPRegistry(): Boolean
@DoNotStrip @JvmStatic public external fun useModernRuntimeScheduler(): Boolean
@DoNotStrip @JvmStatic public external fun override(provider: Any)
@DoNotStrip @JvmStatic public external fun dangerouslyReset()
@@ -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<<cc8e437bf2f486949f256a19d3d73a1e>>
* @generated SignedSource<<4f72683fb2a832d5b77ee2cb37343526>>
*/
/**
@@ -25,21 +25,21 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun commonTestFlag(): Boolean = false
override fun enableBackgroundExecutor(): Boolean = false
override fun useModernRuntimeScheduler(): Boolean = false
override fun enableMicrotasks(): Boolean = false
override fun batchRenderingUpdatesInEventLoop(): Boolean = false
override fun enableSpannableBuildingUnification(): Boolean = false
override fun enableBackgroundExecutor(): Boolean = false
override fun enableCustomDrawOrderFabric(): Boolean = false
override fun enableFixForClippedSubviewsCrash(): Boolean = false
override fun enableMicrotasks(): Boolean = false
override fun enableSpannableBuildingUnification(): Boolean = false
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean = false
override fun inspectorEnableModernCDPRegistry(): Boolean = false
override fun useModernRuntimeScheduler(): Boolean = false
}
@@ -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<<63356ad414e641eae11ca07b1a876fd3>>
* @generated SignedSource<<5fd54183222961f5557dbe0ac111a6ec>>
*/
/**
@@ -25,15 +25,15 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private val accessedFeatureFlags = mutableSetOf<String>()
private var commonTestFlagCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var useModernRuntimeSchedulerCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var batchRenderingUpdatesInEventLoopCache: Boolean? = null
private var enableSpannableBuildingUnificationCache: Boolean? = null
private var enableBackgroundExecutorCache: Boolean? = null
private var enableCustomDrawOrderFabricCache: Boolean? = null
private var enableFixForClippedSubviewsCrashCache: Boolean? = null
private var enableMicrotasksCache: Boolean? = null
private var enableSpannableBuildingUnificationCache: Boolean? = null
private var inspectorEnableCxxInspectorPackagerConnectionCache: Boolean? = null
private var inspectorEnableModernCDPRegistryCache: Boolean? = null
private var useModernRuntimeSchedulerCache: Boolean? = null
override fun commonTestFlag(): Boolean {
var cached = commonTestFlagCache
@@ -45,36 +45,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableBackgroundExecutor(): Boolean {
var cached = enableBackgroundExecutorCache
if (cached == null) {
cached = currentProvider.enableBackgroundExecutor()
accessedFeatureFlags.add("enableBackgroundExecutor")
enableBackgroundExecutorCache = cached
}
return cached
}
override fun useModernRuntimeScheduler(): Boolean {
var cached = useModernRuntimeSchedulerCache
if (cached == null) {
cached = currentProvider.useModernRuntimeScheduler()
accessedFeatureFlags.add("useModernRuntimeScheduler")
useModernRuntimeSchedulerCache = cached
}
return cached
}
override fun enableMicrotasks(): Boolean {
var cached = enableMicrotasksCache
if (cached == null) {
cached = currentProvider.enableMicrotasks()
accessedFeatureFlags.add("enableMicrotasks")
enableMicrotasksCache = cached
}
return cached
}
override fun batchRenderingUpdatesInEventLoop(): Boolean {
var cached = batchRenderingUpdatesInEventLoopCache
if (cached == null) {
@@ -85,12 +55,12 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableSpannableBuildingUnification(): Boolean {
var cached = enableSpannableBuildingUnificationCache
override fun enableBackgroundExecutor(): Boolean {
var cached = enableBackgroundExecutorCache
if (cached == null) {
cached = currentProvider.enableSpannableBuildingUnification()
accessedFeatureFlags.add("enableSpannableBuildingUnification")
enableSpannableBuildingUnificationCache = cached
cached = currentProvider.enableBackgroundExecutor()
accessedFeatureFlags.add("enableBackgroundExecutor")
enableBackgroundExecutorCache = cached
}
return cached
}
@@ -115,6 +85,26 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableMicrotasks(): Boolean {
var cached = enableMicrotasksCache
if (cached == null) {
cached = currentProvider.enableMicrotasks()
accessedFeatureFlags.add("enableMicrotasks")
enableMicrotasksCache = cached
}
return cached
}
override fun enableSpannableBuildingUnification(): Boolean {
var cached = enableSpannableBuildingUnificationCache
if (cached == null) {
cached = currentProvider.enableSpannableBuildingUnification()
accessedFeatureFlags.add("enableSpannableBuildingUnification")
enableSpannableBuildingUnificationCache = cached
}
return cached
}
override fun inspectorEnableCxxInspectorPackagerConnection(): Boolean {
var cached = inspectorEnableCxxInspectorPackagerConnectionCache
if (cached == null) {
@@ -135,6 +125,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun useModernRuntimeScheduler(): Boolean {
var cached = useModernRuntimeSchedulerCache
if (cached == null) {
cached = currentProvider.useModernRuntimeScheduler()
accessedFeatureFlags.add("useModernRuntimeScheduler")
useModernRuntimeSchedulerCache = cached
}
return cached
}
override fun override(provider: ReactNativeFeatureFlagsProvider) {
if (accessedFeatureFlags.isNotEmpty()) {
val accessedFeatureFlagsStr = accessedFeatureFlags.joinToString(separator = ", ") { it }
@@ -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<<c5388e841a06044520f6c89fcca27286>>
* @generated SignedSource<<c4f4d28210d5437839616d49120eb921>>
*/
/**
@@ -25,21 +25,21 @@ import com.facebook.proguard.annotations.DoNotStrip
public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun commonTestFlag(): Boolean
@DoNotStrip public fun enableBackgroundExecutor(): Boolean
@DoNotStrip public fun useModernRuntimeScheduler(): Boolean
@DoNotStrip public fun enableMicrotasks(): Boolean
@DoNotStrip public fun batchRenderingUpdatesInEventLoop(): Boolean
@DoNotStrip public fun enableSpannableBuildingUnification(): Boolean
@DoNotStrip public fun enableBackgroundExecutor(): Boolean
@DoNotStrip public fun enableCustomDrawOrderFabric(): Boolean
@DoNotStrip public fun enableFixForClippedSubviewsCrash(): Boolean
@DoNotStrip public fun enableMicrotasks(): Boolean
@DoNotStrip public fun enableSpannableBuildingUnification(): Boolean
@DoNotStrip public fun inspectorEnableCxxInspectorPackagerConnection(): Boolean
@DoNotStrip public fun inspectorEnableModernCDPRegistry(): Boolean
@DoNotStrip public fun useModernRuntimeScheduler(): Boolean
}
@@ -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<<f40d52242f2c758ed616f1e5d8c3a082>>
* @generated SignedSource<<5b40c18d94331e9ec3fdd1a8814b1292>>
*/
/**
@@ -45,33 +45,15 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableBackgroundExecutor() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableBackgroundExecutor");
return method(javaProvider_);
}
bool useModernRuntimeScheduler() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useModernRuntimeScheduler");
return method(javaProvider_);
}
bool enableMicrotasks() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMicrotasks");
return method(javaProvider_);
}
bool batchRenderingUpdatesInEventLoop() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("batchRenderingUpdatesInEventLoop");
return method(javaProvider_);
}
bool enableSpannableBuildingUnification() override {
bool enableBackgroundExecutor() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableSpannableBuildingUnification");
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableBackgroundExecutor");
return method(javaProvider_);
}
@@ -87,6 +69,18 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableMicrotasks() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableMicrotasks");
return method(javaProvider_);
}
bool enableSpannableBuildingUnification() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableSpannableBuildingUnification");
return method(javaProvider_);
}
bool inspectorEnableCxxInspectorPackagerConnection() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("inspectorEnableCxxInspectorPackagerConnection");
@@ -99,6 +93,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool useModernRuntimeScheduler() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("useModernRuntimeScheduler");
return method(javaProvider_);
}
private:
jni::global_ref<jobject> javaProvider_;
};
@@ -108,29 +108,14 @@ bool JReactNativeFeatureFlagsCxxInterop::commonTestFlag(
return ReactNativeFeatureFlags::commonTestFlag();
}
bool JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool JReactNativeFeatureFlagsCxxInterop::useModernRuntimeScheduler(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
}
bool JReactNativeFeatureFlagsCxxInterop::enableMicrotasks(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableMicrotasks();
}
bool JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
}
bool JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification(
bool JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableSpannableBuildingUnification();
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool JReactNativeFeatureFlagsCxxInterop::enableCustomDrawOrderFabric(
@@ -143,6 +128,16 @@ bool JReactNativeFeatureFlagsCxxInterop::enableFixForClippedSubviewsCrash(
return ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash();
}
bool JReactNativeFeatureFlagsCxxInterop::enableMicrotasks(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableMicrotasks();
}
bool JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableSpannableBuildingUnification();
}
bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableCxxInspectorPackagerConnection(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection();
@@ -153,6 +148,11 @@ bool JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry(
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
}
bool JReactNativeFeatureFlagsCxxInterop::useModernRuntimeScheduler(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
}
void JReactNativeFeatureFlagsCxxInterop::override(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/,
jni::alias_ref<jobject> provider) {
@@ -173,33 +173,33 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"commonTestFlag",
JReactNativeFeatureFlagsCxxInterop::commonTestFlag),
makeNativeMethod(
"enableBackgroundExecutor",
JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor),
makeNativeMethod(
"useModernRuntimeScheduler",
JReactNativeFeatureFlagsCxxInterop::useModernRuntimeScheduler),
makeNativeMethod(
"enableMicrotasks",
JReactNativeFeatureFlagsCxxInterop::enableMicrotasks),
makeNativeMethod(
"batchRenderingUpdatesInEventLoop",
JReactNativeFeatureFlagsCxxInterop::batchRenderingUpdatesInEventLoop),
makeNativeMethod(
"enableSpannableBuildingUnification",
JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification),
"enableBackgroundExecutor",
JReactNativeFeatureFlagsCxxInterop::enableBackgroundExecutor),
makeNativeMethod(
"enableCustomDrawOrderFabric",
JReactNativeFeatureFlagsCxxInterop::enableCustomDrawOrderFabric),
makeNativeMethod(
"enableFixForClippedSubviewsCrash",
JReactNativeFeatureFlagsCxxInterop::enableFixForClippedSubviewsCrash),
makeNativeMethod(
"enableMicrotasks",
JReactNativeFeatureFlagsCxxInterop::enableMicrotasks),
makeNativeMethod(
"enableSpannableBuildingUnification",
JReactNativeFeatureFlagsCxxInterop::enableSpannableBuildingUnification),
makeNativeMethod(
"inspectorEnableCxxInspectorPackagerConnection",
JReactNativeFeatureFlagsCxxInterop::inspectorEnableCxxInspectorPackagerConnection),
makeNativeMethod(
"inspectorEnableModernCDPRegistry",
JReactNativeFeatureFlagsCxxInterop::inspectorEnableModernCDPRegistry),
makeNativeMethod(
"useModernRuntimeScheduler",
JReactNativeFeatureFlagsCxxInterop::useModernRuntimeScheduler),
});
}
@@ -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<<a860f8ca5806886a2e7b0b9a508482a1>>
* @generated SignedSource<<514446a9fd1351df1f7f3b307de54b56>>
*/
/**
@@ -33,19 +33,10 @@ class JReactNativeFeatureFlagsCxxInterop
static bool commonTestFlag(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableBackgroundExecutor(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool useModernRuntimeScheduler(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableMicrotasks(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool batchRenderingUpdatesInEventLoop(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableSpannableBuildingUnification(
static bool enableBackgroundExecutor(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableCustomDrawOrderFabric(
@@ -54,12 +45,21 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableFixForClippedSubviewsCrash(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableMicrotasks(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableSpannableBuildingUnification(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool inspectorEnableCxxInspectorPackagerConnection(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool inspectorEnableModernCDPRegistry(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool useModernRuntimeScheduler(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static void override(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>,
jni::alias_ref<jobject> provider);
@@ -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<<82f226df2b3824d03b755a042b20bec5>>
* @generated SignedSource<<59573653a5f37505d9a52ac76a9dbcff>>
*/
/**
@@ -25,24 +25,12 @@ bool ReactNativeFeatureFlags::commonTestFlag() {
return getAccessor().commonTestFlag();
}
bool ReactNativeFeatureFlags::enableBackgroundExecutor() {
return getAccessor().enableBackgroundExecutor();
}
bool ReactNativeFeatureFlags::useModernRuntimeScheduler() {
return getAccessor().useModernRuntimeScheduler();
}
bool ReactNativeFeatureFlags::enableMicrotasks() {
return getAccessor().enableMicrotasks();
}
bool ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop() {
return getAccessor().batchRenderingUpdatesInEventLoop();
}
bool ReactNativeFeatureFlags::enableSpannableBuildingUnification() {
return getAccessor().enableSpannableBuildingUnification();
bool ReactNativeFeatureFlags::enableBackgroundExecutor() {
return getAccessor().enableBackgroundExecutor();
}
bool ReactNativeFeatureFlags::enableCustomDrawOrderFabric() {
@@ -53,6 +41,14 @@ bool ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash() {
return getAccessor().enableFixForClippedSubviewsCrash();
}
bool ReactNativeFeatureFlags::enableMicrotasks() {
return getAccessor().enableMicrotasks();
}
bool ReactNativeFeatureFlags::enableSpannableBuildingUnification() {
return getAccessor().enableSpannableBuildingUnification();
}
bool ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection() {
return getAccessor().inspectorEnableCxxInspectorPackagerConnection();
}
@@ -61,6 +57,10 @@ bool ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry() {
return getAccessor().inspectorEnableModernCDPRegistry();
}
bool ReactNativeFeatureFlags::useModernRuntimeScheduler() {
return getAccessor().useModernRuntimeScheduler();
}
void ReactNativeFeatureFlags::override(
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
getAccessor().override(std::move(provider));
@@ -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<<3bfae310dfd28040f4b80d1a1df8b7b3>>
* @generated SignedSource<<036e7f3ee4def5b955ed61c707bbc8f8>>
*/
/**
@@ -38,30 +38,15 @@ class ReactNativeFeatureFlags {
*/
static bool commonTestFlag();
/**
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
static bool enableBackgroundExecutor();
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
static bool useModernRuntimeScheduler();
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
static bool enableMicrotasks();
/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
static bool batchRenderingUpdatesInEventLoop();
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
static bool enableSpannableBuildingUnification();
static bool enableBackgroundExecutor();
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
@@ -73,6 +58,16 @@ class ReactNativeFeatureFlags {
*/
static bool enableFixForClippedSubviewsCrash();
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
static bool enableMicrotasks();
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
*/
static bool enableSpannableBuildingUnification();
/**
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
*/
@@ -83,6 +78,11 @@ class ReactNativeFeatureFlags {
*/
static bool inspectorEnableModernCDPRegistry();
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
static bool useModernRuntimeScheduler();
/**
* Overrides the feature flags with the ones provided by the given provider
* (generally one that extends `ReactNativeFeatureFlagsDefaults`).
@@ -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<<2154292f89306f25289583537833a065>>
* @generated SignedSource<<d7a724033028f9edc2b0f9a6714a554d>>
*/
/**
@@ -47,60 +47,6 @@ bool ReactNativeFeatureFlagsAccessor::commonTestFlag() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableBackgroundExecutor() {
auto flagValue = enableBackgroundExecutor_.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(1, "enableBackgroundExecutor");
flagValue = currentProvider_->enableBackgroundExecutor();
enableBackgroundExecutor_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
auto flagValue = useModernRuntimeScheduler_.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(2, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() {
auto flagValue = enableMicrotasks_.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(3, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::batchRenderingUpdatesInEventLoop() {
auto flagValue = batchRenderingUpdatesInEventLoop_.load();
@@ -110,7 +56,7 @@ bool ReactNativeFeatureFlagsAccessor::batchRenderingUpdatesInEventLoop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(4, "batchRenderingUpdatesInEventLoop");
markFlagAsAccessed(1, "batchRenderingUpdatesInEventLoop");
flagValue = currentProvider_->batchRenderingUpdatesInEventLoop();
batchRenderingUpdatesInEventLoop_ = flagValue;
@@ -119,8 +65,8 @@ bool ReactNativeFeatureFlagsAccessor::batchRenderingUpdatesInEventLoop() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableSpannableBuildingUnification() {
auto flagValue = enableSpannableBuildingUnification_.load();
bool ReactNativeFeatureFlagsAccessor::enableBackgroundExecutor() {
auto flagValue = enableBackgroundExecutor_.load();
if (!flagValue.has_value()) {
// This block is not exclusive but it is not necessary.
@@ -128,10 +74,10 @@ bool ReactNativeFeatureFlagsAccessor::enableSpannableBuildingUnification() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(5, "enableSpannableBuildingUnification");
markFlagAsAccessed(2, "enableBackgroundExecutor");
flagValue = currentProvider_->enableSpannableBuildingUnification();
enableSpannableBuildingUnification_ = flagValue;
flagValue = currentProvider_->enableBackgroundExecutor();
enableBackgroundExecutor_ = flagValue;
}
return flagValue.value();
@@ -146,7 +92,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCustomDrawOrderFabric() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableCustomDrawOrderFabric");
markFlagAsAccessed(3, "enableCustomDrawOrderFabric");
flagValue = currentProvider_->enableCustomDrawOrderFabric();
enableCustomDrawOrderFabric_ = flagValue;
@@ -164,7 +110,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFixForClippedSubviewsCrash() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableFixForClippedSubviewsCrash");
markFlagAsAccessed(4, "enableFixForClippedSubviewsCrash");
flagValue = currentProvider_->enableFixForClippedSubviewsCrash();
enableFixForClippedSubviewsCrash_ = flagValue;
@@ -173,6 +119,42 @@ bool ReactNativeFeatureFlagsAccessor::enableFixForClippedSubviewsCrash() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() {
auto flagValue = enableMicrotasks_.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(5, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableSpannableBuildingUnification() {
auto flagValue = enableSpannableBuildingUnification_.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(6, "enableSpannableBuildingUnification");
flagValue = currentProvider_->enableSpannableBuildingUnification();
enableSpannableBuildingUnification_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::inspectorEnableCxxInspectorPackagerConnection() {
auto flagValue = inspectorEnableCxxInspectorPackagerConnection_.load();
@@ -182,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableCxxInspectorPackagerConnect
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "inspectorEnableCxxInspectorPackagerConnection");
markFlagAsAccessed(7, "inspectorEnableCxxInspectorPackagerConnection");
flagValue = currentProvider_->inspectorEnableCxxInspectorPackagerConnection();
inspectorEnableCxxInspectorPackagerConnection_ = flagValue;
@@ -200,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "inspectorEnableModernCDPRegistry");
markFlagAsAccessed(8, "inspectorEnableModernCDPRegistry");
flagValue = currentProvider_->inspectorEnableModernCDPRegistry();
inspectorEnableModernCDPRegistry_ = flagValue;
@@ -209,6 +191,24 @@ bool ReactNativeFeatureFlagsAccessor::inspectorEnableModernCDPRegistry() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
auto flagValue = useModernRuntimeScheduler_.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(9, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
}
return flagValue.value();
}
void ReactNativeFeatureFlagsAccessor::override(
std::unique_ptr<ReactNativeFeatureFlagsProvider> provider) {
if (wasOverridden_) {
@@ -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<<95487968b66d40e1ec53936b06084931>>
* @generated SignedSource<<2fa6a12c1d9b10483d8e2e23125d231e>>
*/
/**
@@ -32,15 +32,15 @@ class ReactNativeFeatureFlagsAccessor {
ReactNativeFeatureFlagsAccessor();
bool commonTestFlag();
bool enableBackgroundExecutor();
bool useModernRuntimeScheduler();
bool enableMicrotasks();
bool batchRenderingUpdatesInEventLoop();
bool enableSpannableBuildingUnification();
bool enableBackgroundExecutor();
bool enableCustomDrawOrderFabric();
bool enableFixForClippedSubviewsCrash();
bool enableMicrotasks();
bool enableSpannableBuildingUnification();
bool inspectorEnableCxxInspectorPackagerConnection();
bool inspectorEnableModernCDPRegistry();
bool useModernRuntimeScheduler();
void override(std::unique_ptr<ReactNativeFeatureFlagsProvider> provider);
@@ -54,15 +54,15 @@ class ReactNativeFeatureFlagsAccessor {
std::array<std::atomic<const char*>, 10> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
std::atomic<std::optional<bool>> useModernRuntimeScheduler_;
std::atomic<std::optional<bool>> enableMicrotasks_;
std::atomic<std::optional<bool>> batchRenderingUpdatesInEventLoop_;
std::atomic<std::optional<bool>> enableSpannableBuildingUnification_;
std::atomic<std::optional<bool>> enableBackgroundExecutor_;
std::atomic<std::optional<bool>> enableCustomDrawOrderFabric_;
std::atomic<std::optional<bool>> enableFixForClippedSubviewsCrash_;
std::atomic<std::optional<bool>> enableMicrotasks_;
std::atomic<std::optional<bool>> enableSpannableBuildingUnification_;
std::atomic<std::optional<bool>> inspectorEnableCxxInspectorPackagerConnection_;
std::atomic<std::optional<bool>> inspectorEnableModernCDPRegistry_;
std::atomic<std::optional<bool>> useModernRuntimeScheduler_;
};
} // namespace facebook::react
@@ -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<<4832483bb3648380f2bb9312311f579c>>
* @generated SignedSource<<927bc1410a5baadf3a4005e50067c4df>>
*/
/**
@@ -31,23 +31,11 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableBackgroundExecutor() override {
return false;
}
bool useModernRuntimeScheduler() override {
return false;
}
bool enableMicrotasks() override {
return false;
}
bool batchRenderingUpdatesInEventLoop() override {
return false;
}
bool enableSpannableBuildingUnification() override {
bool enableBackgroundExecutor() override {
return false;
}
@@ -59,6 +47,14 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return false;
}
bool enableMicrotasks() override {
return false;
}
bool enableSpannableBuildingUnification() override {
return false;
}
bool inspectorEnableCxxInspectorPackagerConnection() override {
return false;
}
@@ -66,6 +62,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
bool inspectorEnableModernCDPRegistry() override {
return false;
}
bool useModernRuntimeScheduler() override {
return false;
}
};
} // namespace facebook::react
@@ -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<<f707d15cf978d7342cdf5aab18444219>>
* @generated SignedSource<<74b4ca674d50bda5fb18d74568024399>>
*/
/**
@@ -26,15 +26,15 @@ class ReactNativeFeatureFlagsProvider {
virtual ~ReactNativeFeatureFlagsProvider() = default;
virtual bool commonTestFlag() = 0;
virtual bool enableBackgroundExecutor() = 0;
virtual bool useModernRuntimeScheduler() = 0;
virtual bool enableMicrotasks() = 0;
virtual bool batchRenderingUpdatesInEventLoop() = 0;
virtual bool enableSpannableBuildingUnification() = 0;
virtual bool enableBackgroundExecutor() = 0;
virtual bool enableCustomDrawOrderFabric() = 0;
virtual bool enableFixForClippedSubviewsCrash() = 0;
virtual bool enableMicrotasks() = 0;
virtual bool enableSpannableBuildingUnification() = 0;
virtual bool inspectorEnableCxxInspectorPackagerConnection() = 0;
virtual bool inspectorEnableModernCDPRegistry() = 0;
virtual bool useModernRuntimeScheduler() = 0;
};
} // namespace facebook::react
@@ -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<<003a5e1b1e52d504e9cd29583b475041>>
* @generated SignedSource<<1a785df8b045c1340d3139bd85add42b>>
*/
/**
@@ -42,29 +42,14 @@ bool NativeReactNativeFeatureFlags::commonTestFlag(
return ReactNativeFeatureFlags::commonTestFlag();
}
bool NativeReactNativeFeatureFlags::enableBackgroundExecutor(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool NativeReactNativeFeatureFlags::useModernRuntimeScheduler(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
}
bool NativeReactNativeFeatureFlags::enableMicrotasks(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableMicrotasks();
}
bool NativeReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::batchRenderingUpdatesInEventLoop();
}
bool NativeReactNativeFeatureFlags::enableSpannableBuildingUnification(
bool NativeReactNativeFeatureFlags::enableBackgroundExecutor(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableSpannableBuildingUnification();
return ReactNativeFeatureFlags::enableBackgroundExecutor();
}
bool NativeReactNativeFeatureFlags::enableCustomDrawOrderFabric(
@@ -77,6 +62,16 @@ bool NativeReactNativeFeatureFlags::enableFixForClippedSubviewsCrash(
return ReactNativeFeatureFlags::enableFixForClippedSubviewsCrash();
}
bool NativeReactNativeFeatureFlags::enableMicrotasks(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableMicrotasks();
}
bool NativeReactNativeFeatureFlags::enableSpannableBuildingUnification(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableSpannableBuildingUnification();
}
bool NativeReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::inspectorEnableCxxInspectorPackagerConnection();
@@ -87,4 +82,9 @@ bool NativeReactNativeFeatureFlags::inspectorEnableModernCDPRegistry(
return ReactNativeFeatureFlags::inspectorEnableModernCDPRegistry();
}
bool NativeReactNativeFeatureFlags::useModernRuntimeScheduler(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::useModernRuntimeScheduler();
}
} // namespace facebook::react
@@ -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<<26be12cc19ed1a9cd2dbdab684594204>>
* @generated SignedSource<<c9ed3da29eba982bc9cbc122e077e04c>>
*/
/**
@@ -38,23 +38,23 @@ class NativeReactNativeFeatureFlags
bool commonTestFlag(jsi::Runtime& runtime);
bool enableBackgroundExecutor(jsi::Runtime& runtime);
bool useModernRuntimeScheduler(jsi::Runtime& runtime);
bool enableMicrotasks(jsi::Runtime& runtime);
bool batchRenderingUpdatesInEventLoop(jsi::Runtime& runtime);
bool enableSpannableBuildingUnification(jsi::Runtime& runtime);
bool enableBackgroundExecutor(jsi::Runtime& runtime);
bool enableCustomDrawOrderFabric(jsi::Runtime& runtime);
bool enableFixForClippedSubviewsCrash(jsi::Runtime& runtime);
bool enableMicrotasks(jsi::Runtime& runtime);
bool enableSpannableBuildingUnification(jsi::Runtime& runtime);
bool inspectorEnableCxxInspectorPackagerConnection(jsi::Runtime& runtime);
bool inspectorEnableModernCDPRegistry(jsi::Runtime& runtime);
bool useModernRuntimeScheduler(jsi::Runtime& runtime);
};
} // namespace facebook::react
@@ -8,103 +8,113 @@
* @format
*/
/* eslint sort-keys: 'error' */
import type {FeatureFlagDefinitions} from './types';
// These flags are only used in tests for the feature flags system
const testDefinitions: FeatureFlagDefinitions = {
common: {
commonTestFlag: {
defaultValue: false,
description: 'Common flag for testing. Do NOT modify.',
},
},
jsOnly: {
jsOnlyTestFlag: {
defaultValue: false,
description: 'JS-only flag for testing. Do NOT modify.',
},
},
};
const definitions: FeatureFlagDefinitions = {
common: {
// This is only used in unit tests for the feature flags system.
commonTestFlag: {
description: 'Common flag for testing. Do NOT modify.',
defaultValue: false,
},
...testDefinitions.common,
enableBackgroundExecutor: {
description:
'Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).',
defaultValue: false,
},
useModernRuntimeScheduler: {
description:
'When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.',
defaultValue: false,
},
enableMicrotasks: {
description:
'Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).',
defaultValue: false,
},
batchRenderingUpdatesInEventLoop: {
defaultValue: false,
description:
'When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.',
defaultValue: false,
},
enableSpannableBuildingUnification: {
description:
'Uses new, deduplicated logic for constructing Android Spannables from text fragments',
enableBackgroundExecutor: {
defaultValue: false,
description:
'Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).',
},
enableCustomDrawOrderFabric: {
defaultValue: false,
description:
'When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).',
defaultValue: false,
},
enableFixForClippedSubviewsCrash: {
defaultValue: false,
description:
'Attempt at fixing a crash related to subview clipping on Android. This is a kill switch for the fix',
},
enableMicrotasks: {
defaultValue: false,
description:
'Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).',
},
enableSpannableBuildingUnification: {
defaultValue: false,
description:
'Uses new, deduplicated logic for constructing Android Spannables from text fragments',
},
inspectorEnableCxxInspectorPackagerConnection: {
defaultValue: false,
description:
'Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.',
defaultValue: false,
},
inspectorEnableModernCDPRegistry: {
defaultValue: false,
description:
'Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.',
},
useModernRuntimeScheduler: {
defaultValue: false,
description:
'When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.',
},
},
jsOnly: {
// This is only used in unit tests for the feature flags system.
jsOnlyTestFlag: {
description: 'JS-only flag for testing. Do NOT modify.',
defaultValue: false,
},
...testDefinitions.jsOnly,
isLayoutAnimationEnabled: {
description:
'Function used to enable / disabled Layout Animations in React Native.',
defaultValue: true,
},
animatedShouldDebounceQueueFlush: {
defaultValue: false,
description:
'Enables an experimental flush-queue debouncing in Animated.js.',
defaultValue: false,
},
animatedShouldUseSingleOp: {
defaultValue: false,
description:
'Enables an experimental mega-operation for Animated.js that replaces many calls to native with a single call into native, to reduce JSI/JNI traffic.',
defaultValue: false,
},
enableAccessToHostTreeInFabric: {
defaultValue: false,
description:
'Enables access to the host tree in Fabric using DOM-compatible APIs.',
defaultValue: false,
},
isLayoutAnimationEnabled: {
defaultValue: true,
description:
'Function used to enable / disabled Layout Animations in React Native.',
},
shouldUseAnimatedObjectForTransform: {
defaultValue: false,
description:
'Enables use of AnimatedObject for animating transform values.',
defaultValue: false,
},
shouldUseSetNativePropsInFabric: {
description: 'Enables use of setNativeProps in JS driven animations.',
defaultValue: true,
},
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: {
defaultValue: false,
description:
'removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android',
defaultValue: false,
},
shouldUseSetNativePropsInFabric: {
defaultValue: true,
description: 'Enables use of setNativeProps in JS driven animations.',
},
},
};
@@ -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<<8509d5ee87efb5aa8da7efcd2085d0a2>>
* @generated SignedSource<<fd6c4691a532a520ba08ef0ed2ae297c>>
* @flow strict-local
*/
@@ -24,15 +24,15 @@ import * as TurboModuleRegistry from '../../../Libraries/TurboModule/TurboModule
export interface Spec extends TurboModule {
+commonTestFlag?: () => boolean;
+enableBackgroundExecutor?: () => boolean;
+useModernRuntimeScheduler?: () => boolean;
+enableMicrotasks?: () => boolean;
+batchRenderingUpdatesInEventLoop?: () => boolean;
+enableSpannableBuildingUnification?: () => boolean;
+enableBackgroundExecutor?: () => boolean;
+enableCustomDrawOrderFabric?: () => boolean;
+enableFixForClippedSubviewsCrash?: () => boolean;
+enableMicrotasks?: () => boolean;
+enableSpannableBuildingUnification?: () => boolean;
+inspectorEnableCxxInspectorPackagerConnection?: () => boolean;
+inspectorEnableModernCDPRegistry?: () => boolean;
+useModernRuntimeScheduler?: () => boolean;
}
const NativeReactNativeFeatureFlags: ?Spec = TurboModuleRegistry.get<Spec>(
@@ -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<<7c83d5613c3be517efe48378e6356e79>>
* @generated SignedSource<<c055b3ee44111eb5e3367c664befc685>>
* @flow strict-local
*/
@@ -27,13 +27,13 @@ import {
export type ReactNativeFeatureFlagsJsOnly = {
jsOnlyTestFlag: Getter<boolean>,
isLayoutAnimationEnabled: Getter<boolean>,
animatedShouldDebounceQueueFlush: Getter<boolean>,
animatedShouldUseSingleOp: Getter<boolean>,
enableAccessToHostTreeInFabric: Getter<boolean>,
isLayoutAnimationEnabled: Getter<boolean>,
shouldUseAnimatedObjectForTransform: Getter<boolean>,
shouldUseSetNativePropsInFabric: Getter<boolean>,
shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean>,
shouldUseSetNativePropsInFabric: Getter<boolean>,
};
export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureFlagsJsOnly>;
@@ -41,15 +41,15 @@ export type ReactNativeFeatureFlagsJsOnlyOverrides = Partial<ReactNativeFeatureF
export type ReactNativeFeatureFlags = {
...ReactNativeFeatureFlagsJsOnly,
commonTestFlag: Getter<boolean>,
enableBackgroundExecutor: Getter<boolean>,
useModernRuntimeScheduler: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
batchRenderingUpdatesInEventLoop: Getter<boolean>,
enableSpannableBuildingUnification: Getter<boolean>,
enableBackgroundExecutor: Getter<boolean>,
enableCustomDrawOrderFabric: Getter<boolean>,
enableFixForClippedSubviewsCrash: Getter<boolean>,
enableMicrotasks: Getter<boolean>,
enableSpannableBuildingUnification: Getter<boolean>,
inspectorEnableCxxInspectorPackagerConnection: Getter<boolean>,
inspectorEnableModernCDPRegistry: Getter<boolean>,
useModernRuntimeScheduler: Getter<boolean>,
}
/**
@@ -57,11 +57,6 @@ export type ReactNativeFeatureFlags = {
*/
export const jsOnlyTestFlag: Getter<boolean> = createJavaScriptFlagGetter('jsOnlyTestFlag', false);
/**
* Function used to enable / disabled Layout Animations in React Native.
*/
export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
/**
* Enables an experimental flush-queue debouncing in Animated.js.
*/
@@ -77,45 +72,38 @@ export const animatedShouldUseSingleOp: Getter<boolean> = createJavaScriptFlagGe
*/
export const enableAccessToHostTreeInFabric: Getter<boolean> = createJavaScriptFlagGetter('enableAccessToHostTreeInFabric', false);
/**
* Function used to enable / disabled Layout Animations in React Native.
*/
export const isLayoutAnimationEnabled: Getter<boolean> = createJavaScriptFlagGetter('isLayoutAnimationEnabled', true);
/**
* Enables use of AnimatedObject for animating transform values.
*/
export const shouldUseAnimatedObjectForTransform: Getter<boolean> = createJavaScriptFlagGetter('shouldUseAnimatedObjectForTransform', false);
/**
* Enables use of setNativeProps in JS driven animations.
*/
export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInFabric', true);
/**
* removeClippedSubviews prop will be used as the default in FlatList on iOS to match Android
*/
export const shouldUseRemoveClippedSubviewsAsDefaultOnIOS: Getter<boolean> = createJavaScriptFlagGetter('shouldUseRemoveClippedSubviewsAsDefaultOnIOS', false);
/**
* Enables use of setNativeProps in JS driven animations.
*/
export const shouldUseSetNativePropsInFabric: Getter<boolean> = createJavaScriptFlagGetter('shouldUseSetNativePropsInFabric', true);
/**
* Common flag for testing. Do NOT modify.
*/
export const commonTestFlag: Getter<boolean> = createNativeFlagGetter('commonTestFlag', false);
/**
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
export const enableBackgroundExecutor: Getter<boolean> = createNativeFlagGetter('enableBackgroundExecutor', false);
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
export const useModernRuntimeScheduler: Getter<boolean> = createNativeFlagGetter('useModernRuntimeScheduler', false);
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableMicrotasks', false);
/**
* When enabled, the RuntimeScheduler processing the event loop will batch all rendering updates and dispatch them together at the end of each iteration of the loop.
*/
export const batchRenderingUpdatesInEventLoop: Getter<boolean> = createNativeFlagGetter('batchRenderingUpdatesInEventLoop', false);
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
* Enables the use of a background executor to compute layout and commit updates on Fabric (this system is deprecated and should not be used).
*/
export const enableSpannableBuildingUnification: Getter<boolean> = createNativeFlagGetter('enableSpannableBuildingUnification', false);
export const enableBackgroundExecutor: Getter<boolean> = createNativeFlagGetter('enableBackgroundExecutor', false);
/**
* When enabled, Fabric will use customDrawOrder in ReactViewGroup (similar to old architecture).
*/
@@ -124,6 +112,14 @@ export const enableCustomDrawOrderFabric: Getter<boolean> = createNativeFlagGett
* Attempt at fixing a crash related to subview clipping on Android. This is a kill switch for the fix
*/
export const enableFixForClippedSubviewsCrash: Getter<boolean> = createNativeFlagGetter('enableFixForClippedSubviewsCrash', false);
/**
* Enables the use of microtasks in Hermes (scheduling) and RuntimeScheduler (execution).
*/
export const enableMicrotasks: Getter<boolean> = createNativeFlagGetter('enableMicrotasks', false);
/**
* Uses new, deduplicated logic for constructing Android Spannables from text fragments
*/
export const enableSpannableBuildingUnification: Getter<boolean> = createNativeFlagGetter('enableSpannableBuildingUnification', false);
/**
* Flag determining if the C++ implementation of InspectorPackagerConnection should be used instead of the per-platform one. This flag is global and should not be changed across React Host lifetimes.
*/
@@ -132,6 +128,10 @@ export const inspectorEnableCxxInspectorPackagerConnection: Getter<boolean> = cr
* Flag determining if the modern CDP backend should be enabled. This flag is global and should not be changed across React Host lifetimes.
*/
export const inspectorEnableModernCDPRegistry: Getter<boolean> = createNativeFlagGetter('inspectorEnableModernCDPRegistry', false);
/**
* When enabled, it uses the modern fork of RuntimeScheduler that allows scheduling tasks with priorities from any thread.
*/
export const useModernRuntimeScheduler: Getter<boolean> = createNativeFlagGetter('useModernRuntimeScheduler', false);
/**
* Overrides the feature flags with the provided methods.