add feature flag for line height gating (#46408)

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

## Changelog:

[Android] [Added] - new feature flag for line height calculation

## Context
Adding feature flag for line height calculation centering.

There is a recurring issue in React Native where text containing accented characters, non-latin scripts, and special glyphs experiences truncation when line height is set too small, even when the line height equals or exceeds the font size. This causes issues in rendering complex text in multiple languages or special character sets.

See: https://docs.google.com/document/d/1W-A80gKAyhVbz_WKktSwwJP5qm6h6ZBjFNcsVbknXhI/edit?usp=sharing for more context

## Investigation
Previously, when font metrics (ascent, descent, top, bottom) exceeded the line height, the logic arbitrarily prioritized descent over ascent and bottom top. This led to vertical misalignment and text clipping at the top of the text.

## Implementation:

1. Descent Exceeds Line Height:
Descent is capped to fit within the line height, setting ascent and top to 0, similar to the current behavior.
2. Shrink ascent and descent equally:
When the combined ascent and descent exceed the line height, the vertical deficit is split proportionally between them, ensuring even distribution of the space.
3. Proportionally shrink top and bottom:
If the top and bottom together exceed the line height, reductions are now applied proportionally based on the delta between top and ascent and bottom and descent.

Reviewed By: NickGerleman

Differential Revision: D62421775

fbshipit-source-id: 6b0542426d7ee575f4986e60ddf92247542b65cb
This commit is contained in:
Melissa Liu authored and Facebook GitHub Bot committed 2024-09-11 14:53:09 -07:00
1 parent 4014aa4528
commit f338e7c0a1
19 files changed
+163 -61

No files matched your search

@@ -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<<6cc52570dd571ddc792a0fd842c05dd9>>
* @generated SignedSource<<312da6e350ea6b96180156a341810654>>
*/
/**
@@ -64,6 +64,12 @@ public object ReactNativeFeatureFlags {
@JvmStatic
public fun enableAlignItemsBaselineOnFabricIOS(): Boolean = accessor.enableAlignItemsBaselineOnFabricIOS()
/**
* When enabled, custom line height calculation will be centered from top to bottom.
*/
@JvmStatic
public fun enableAndroidLineHeightCentering(): Boolean = accessor.enableAndroidLineHeightCentering()
/**
* Enables mix-blend-mode prop on Android.
*/
@@ -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<<eca842a1b1c823b72136c625b3bfd16e>>
* @generated SignedSource<<a397b9b648fab0e8b1f9d8a9dba04ab4>>
*/
/**
@@ -26,6 +26,7 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableAndroidMixBlendModePropCache: Boolean? = null
private var enableBackgroundStyleApplicatorCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
@@ -123,6 +124,15 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
return cached
}
override fun enableAndroidLineHeightCentering(): Boolean {
var cached = enableAndroidLineHeightCenteringCache
if (cached == null) {
cached = ReactNativeFeatureFlagsCxxInterop.enableAndroidLineHeightCentering()
enableAndroidLineHeightCenteringCache = cached
}
return cached
}
override fun enableAndroidMixBlendModeProp(): Boolean {
var cached = enableAndroidMixBlendModePropCache
if (cached == null) {
@@ -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<<ad54375c4ae3be2f377260887ae5aaf9>>
* @generated SignedSource<<ba7f0d3c03fef86fb12e4d9842dcb241>>
*/
/**
@@ -40,6 +40,8 @@ public object ReactNativeFeatureFlagsCxxInterop {
@DoNotStrip @JvmStatic public external fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@DoNotStrip @JvmStatic public external fun enableAndroidLineHeightCentering(): Boolean
@DoNotStrip @JvmStatic public external fun enableAndroidMixBlendModeProp(): Boolean
@DoNotStrip @JvmStatic public external fun enableBackgroundStyleApplicator(): 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<<2a0cd5a4875a54bb724e5765ffe7753e>>
* @generated SignedSource<<fa8245a05ab1f508318e1d18938f9dab>>
*/
/**
@@ -35,6 +35,8 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
override fun enableAlignItemsBaselineOnFabricIOS(): Boolean = true
override fun enableAndroidLineHeightCentering(): Boolean = false
override fun enableAndroidMixBlendModeProp(): Boolean = false
override fun enableBackgroundStyleApplicator(): Boolean = true
@@ -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<<d02af2a8ef015c57d45aba8280539606>>
* @generated SignedSource<<069787b84036b763c47d128e66ddd1ab>>
*/
/**
@@ -30,6 +30,7 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
private var completeReactInstanceCreationOnBgThreadOnAndroidCache: Boolean? = null
private var destroyFabricSurfacesInReactInstanceManagerCache: Boolean? = null
private var enableAlignItemsBaselineOnFabricIOSCache: Boolean? = null
private var enableAndroidLineHeightCenteringCache: Boolean? = null
private var enableAndroidMixBlendModePropCache: Boolean? = null
private var enableBackgroundStyleApplicatorCache: Boolean? = null
private var enableCleanTextInputYogaNodeCache: Boolean? = null
@@ -133,6 +134,16 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
return cached
}
override fun enableAndroidLineHeightCentering(): Boolean {
var cached = enableAndroidLineHeightCenteringCache
if (cached == null) {
cached = currentProvider.enableAndroidLineHeightCentering()
accessedFeatureFlags.add("enableAndroidLineHeightCentering")
enableAndroidLineHeightCenteringCache = cached
}
return cached
}
override fun enableAndroidMixBlendModeProp(): Boolean {
var cached = enableAndroidMixBlendModePropCache
if (cached == null) {
@@ -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<<92b1214e3a526d7c67dcc7b0c2a131de>>
* @generated SignedSource<<978d9e8d1129951f3c5750f95e2ff5d2>>
*/
/**
@@ -35,6 +35,8 @@ public interface ReactNativeFeatureFlagsProvider {
@DoNotStrip public fun enableAlignItemsBaselineOnFabricIOS(): Boolean
@DoNotStrip public fun enableAndroidLineHeightCentering(): Boolean
@DoNotStrip public fun enableAndroidMixBlendModeProp(): Boolean
@DoNotStrip public fun enableBackgroundStyleApplicator(): 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<<c23b21fca18699470580e54b99de1126>>
* @generated SignedSource<<63ef974f6ed666553bc0be593730a08e>>
*/
/**
@@ -75,6 +75,12 @@ class ReactNativeFeatureFlagsProviderHolder
return method(javaProvider_);
}
bool enableAndroidLineHeightCentering() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAndroidLineHeightCentering");
return method(javaProvider_);
}
bool enableAndroidMixBlendModeProp() override {
static const auto method =
getReactNativeFeatureFlagsProviderJavaClass()->getMethod<jboolean()>("enableAndroidMixBlendModeProp");
@@ -361,6 +367,11 @@ bool JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS(
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
}
bool JReactNativeFeatureFlagsCxxInterop::enableAndroidLineHeightCentering(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAndroidLineHeightCentering();
}
bool JReactNativeFeatureFlagsCxxInterop::enableAndroidMixBlendModeProp(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop> /*unused*/) {
return ReactNativeFeatureFlags::enableAndroidMixBlendModeProp();
@@ -606,6 +617,9 @@ void JReactNativeFeatureFlagsCxxInterop::registerNatives() {
makeNativeMethod(
"enableAlignItemsBaselineOnFabricIOS",
JReactNativeFeatureFlagsCxxInterop::enableAlignItemsBaselineOnFabricIOS),
makeNativeMethod(
"enableAndroidLineHeightCentering",
JReactNativeFeatureFlagsCxxInterop::enableAndroidLineHeightCentering),
makeNativeMethod(
"enableAndroidMixBlendModeProp",
JReactNativeFeatureFlagsCxxInterop::enableAndroidMixBlendModeProp),
@@ -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<<89d0da3b2bb56a4ee3c887e6c57491b2>>
* @generated SignedSource<<d39aa0038255aedc5613fc2e44b9ad88>>
*/
/**
@@ -48,6 +48,9 @@ class JReactNativeFeatureFlagsCxxInterop
static bool enableAlignItemsBaselineOnFabricIOS(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableAndroidLineHeightCentering(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
static bool enableAndroidMixBlendModeProp(
facebook::jni::alias_ref<JReactNativeFeatureFlagsCxxInterop>);
@@ -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<<6139aa47aac3e5682a453a416bc10236>>
* @generated SignedSource<<7c97c370b2f453691c153fb370bea149>>
*/
/**
@@ -45,6 +45,10 @@ bool ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS() {
return getAccessor().enableAlignItemsBaselineOnFabricIOS();
}
bool ReactNativeFeatureFlags::enableAndroidLineHeightCentering() {
return getAccessor().enableAndroidLineHeightCentering();
}
bool ReactNativeFeatureFlags::enableAndroidMixBlendModeProp() {
return getAccessor().enableAndroidMixBlendModeProp();
}
@@ -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<<c8266eb27ec23aaa856fa95275503a81>>
* @generated SignedSource<<c3f43e92b0710e4a68bb76d874b3058d>>
*/
/**
@@ -67,6 +67,11 @@ class ReactNativeFeatureFlags {
*/
RN_EXPORT static bool enableAlignItemsBaselineOnFabricIOS();
/**
* When enabled, custom line height calculation will be centered from top to bottom.
*/
RN_EXPORT static bool enableAndroidLineHeightCentering();
/**
* Enables mix-blend-mode prop on Android.
*/
@@ -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<<dadda9bba46220975852baddb41e7dc9>>
* @generated SignedSource<<0ea766879653efe26784aacb9823872e>>
*/
/**
@@ -137,6 +137,24 @@ bool ReactNativeFeatureFlagsAccessor::enableAlignItemsBaselineOnFabricIOS() {
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableAndroidLineHeightCentering() {
auto flagValue = enableAndroidLineHeightCentering_.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, "enableAndroidLineHeightCentering");
flagValue = currentProvider_->enableAndroidLineHeightCentering();
enableAndroidLineHeightCentering_ = flagValue;
}
return flagValue.value();
}
bool ReactNativeFeatureFlagsAccessor::enableAndroidMixBlendModeProp() {
auto flagValue = enableAndroidMixBlendModeProp_.load();
@@ -146,7 +164,7 @@ bool ReactNativeFeatureFlagsAccessor::enableAndroidMixBlendModeProp() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(6, "enableAndroidMixBlendModeProp");
markFlagAsAccessed(7, "enableAndroidMixBlendModeProp");
flagValue = currentProvider_->enableAndroidMixBlendModeProp();
enableAndroidMixBlendModeProp_ = flagValue;
@@ -164,7 +182,7 @@ bool ReactNativeFeatureFlagsAccessor::enableBackgroundStyleApplicator() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(7, "enableBackgroundStyleApplicator");
markFlagAsAccessed(8, "enableBackgroundStyleApplicator");
flagValue = currentProvider_->enableBackgroundStyleApplicator();
enableBackgroundStyleApplicator_ = flagValue;
@@ -182,7 +200,7 @@ bool ReactNativeFeatureFlagsAccessor::enableCleanTextInputYogaNode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(8, "enableCleanTextInputYogaNode");
markFlagAsAccessed(9, "enableCleanTextInputYogaNode");
flagValue = currentProvider_->enableCleanTextInputYogaNode();
enableCleanTextInputYogaNode_ = flagValue;
@@ -200,7 +218,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEagerRootViewAttachment() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(9, "enableEagerRootViewAttachment");
markFlagAsAccessed(10, "enableEagerRootViewAttachment");
flagValue = currentProvider_->enableEagerRootViewAttachment();
enableEagerRootViewAttachment_ = flagValue;
@@ -218,7 +236,7 @@ bool ReactNativeFeatureFlagsAccessor::enableEventEmitterRetentionDuringGesturesO
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(10, "enableEventEmitterRetentionDuringGesturesOnAndroid");
markFlagAsAccessed(11, "enableEventEmitterRetentionDuringGesturesOnAndroid");
flagValue = currentProvider_->enableEventEmitterRetentionDuringGesturesOnAndroid();
enableEventEmitterRetentionDuringGesturesOnAndroid_ = flagValue;
@@ -236,7 +254,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricLogs() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(11, "enableFabricLogs");
markFlagAsAccessed(12, "enableFabricLogs");
flagValue = currentProvider_->enableFabricLogs();
enableFabricLogs_ = flagValue;
@@ -254,7 +272,7 @@ bool ReactNativeFeatureFlagsAccessor::enableFabricRendererExclusively() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(12, "enableFabricRendererExclusively");
markFlagAsAccessed(13, "enableFabricRendererExclusively");
flagValue = currentProvider_->enableFabricRendererExclusively();
enableFabricRendererExclusively_ = flagValue;
@@ -272,7 +290,7 @@ bool ReactNativeFeatureFlagsAccessor::enableGranularShadowTreeStateReconciliatio
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(13, "enableGranularShadowTreeStateReconciliation");
markFlagAsAccessed(14, "enableGranularShadowTreeStateReconciliation");
flagValue = currentProvider_->enableGranularShadowTreeStateReconciliation();
enableGranularShadowTreeStateReconciliation_ = flagValue;
@@ -290,7 +308,7 @@ bool ReactNativeFeatureFlagsAccessor::enableIOSViewClipToPaddingBox() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(14, "enableIOSViewClipToPaddingBox");
markFlagAsAccessed(15, "enableIOSViewClipToPaddingBox");
flagValue = currentProvider_->enableIOSViewClipToPaddingBox();
enableIOSViewClipToPaddingBox_ = flagValue;
@@ -308,7 +326,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLayoutAnimationsOnIOS() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(15, "enableLayoutAnimationsOnIOS");
markFlagAsAccessed(16, "enableLayoutAnimationsOnIOS");
flagValue = currentProvider_->enableLayoutAnimationsOnIOS();
enableLayoutAnimationsOnIOS_ = flagValue;
@@ -326,7 +344,7 @@ bool ReactNativeFeatureFlagsAccessor::enableLongTaskAPI() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(16, "enableLongTaskAPI");
markFlagAsAccessed(17, "enableLongTaskAPI");
flagValue = currentProvider_->enableLongTaskAPI();
enableLongTaskAPI_ = flagValue;
@@ -344,7 +362,7 @@ bool ReactNativeFeatureFlagsAccessor::enableMicrotasks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(17, "enableMicrotasks");
markFlagAsAccessed(18, "enableMicrotasks");
flagValue = currentProvider_->enableMicrotasks();
enableMicrotasks_ = flagValue;
@@ -362,7 +380,7 @@ bool ReactNativeFeatureFlagsAccessor::enablePropsUpdateReconciliationAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(18, "enablePropsUpdateReconciliationAndroid");
markFlagAsAccessed(19, "enablePropsUpdateReconciliationAndroid");
flagValue = currentProvider_->enablePropsUpdateReconciliationAndroid();
enablePropsUpdateReconciliationAndroid_ = flagValue;
@@ -380,7 +398,7 @@ bool ReactNativeFeatureFlagsAccessor::enableReportEventPaintTime() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(19, "enableReportEventPaintTime");
markFlagAsAccessed(20, "enableReportEventPaintTime");
flagValue = currentProvider_->enableReportEventPaintTime();
enableReportEventPaintTime_ = flagValue;
@@ -398,7 +416,7 @@ bool ReactNativeFeatureFlagsAccessor::enableSynchronousStateUpdates() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(20, "enableSynchronousStateUpdates");
markFlagAsAccessed(21, "enableSynchronousStateUpdates");
flagValue = currentProvider_->enableSynchronousStateUpdates();
enableSynchronousStateUpdates_ = flagValue;
@@ -416,7 +434,7 @@ bool ReactNativeFeatureFlagsAccessor::enableUIConsistency() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(21, "enableUIConsistency");
markFlagAsAccessed(22, "enableUIConsistency");
flagValue = currentProvider_->enableUIConsistency();
enableUIConsistency_ = flagValue;
@@ -434,7 +452,7 @@ bool ReactNativeFeatureFlagsAccessor::enableViewRecycling() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(22, "enableViewRecycling");
markFlagAsAccessed(23, "enableViewRecycling");
flagValue = currentProvider_->enableViewRecycling();
enableViewRecycling_ = flagValue;
@@ -452,7 +470,7 @@ bool ReactNativeFeatureFlagsAccessor::excludeYogaFromRawProps() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(23, "excludeYogaFromRawProps");
markFlagAsAccessed(24, "excludeYogaFromRawProps");
flagValue = currentProvider_->excludeYogaFromRawProps();
excludeYogaFromRawProps_ = flagValue;
@@ -470,7 +488,7 @@ bool ReactNativeFeatureFlagsAccessor::fetchImagesInViewPreallocation() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(24, "fetchImagesInViewPreallocation");
markFlagAsAccessed(25, "fetchImagesInViewPreallocation");
flagValue = currentProvider_->fetchImagesInViewPreallocation();
fetchImagesInViewPreallocation_ = flagValue;
@@ -488,7 +506,7 @@ bool ReactNativeFeatureFlagsAccessor::fixIncorrectScrollViewStateUpdateOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(25, "fixIncorrectScrollViewStateUpdateOnAndroid");
markFlagAsAccessed(26, "fixIncorrectScrollViewStateUpdateOnAndroid");
flagValue = currentProvider_->fixIncorrectScrollViewStateUpdateOnAndroid();
fixIncorrectScrollViewStateUpdateOnAndroid_ = flagValue;
@@ -506,7 +524,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMappingOfEventPrioritiesBetweenFabricAn
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(26, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
markFlagAsAccessed(27, "fixMappingOfEventPrioritiesBetweenFabricAndReact");
flagValue = currentProvider_->fixMappingOfEventPrioritiesBetweenFabricAndReact();
fixMappingOfEventPrioritiesBetweenFabricAndReact_ = flagValue;
@@ -524,7 +542,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMissedFabricStateUpdatesOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(27, "fixMissedFabricStateUpdatesOnAndroid");
markFlagAsAccessed(28, "fixMissedFabricStateUpdatesOnAndroid");
flagValue = currentProvider_->fixMissedFabricStateUpdatesOnAndroid();
fixMissedFabricStateUpdatesOnAndroid_ = flagValue;
@@ -542,7 +560,7 @@ bool ReactNativeFeatureFlagsAccessor::fixMountingCoordinatorReportedPendingTrans
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(28, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
markFlagAsAccessed(29, "fixMountingCoordinatorReportedPendingTransactionsOnAndroid");
flagValue = currentProvider_->fixMountingCoordinatorReportedPendingTransactionsOnAndroid();
fixMountingCoordinatorReportedPendingTransactionsOnAndroid_ = flagValue;
@@ -560,7 +578,7 @@ bool ReactNativeFeatureFlagsAccessor::forceBatchingMountItemsOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(29, "forceBatchingMountItemsOnAndroid");
markFlagAsAccessed(30, "forceBatchingMountItemsOnAndroid");
flagValue = currentProvider_->forceBatchingMountItemsOnAndroid();
forceBatchingMountItemsOnAndroid_ = flagValue;
@@ -578,7 +596,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledDebug() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(30, "fuseboxEnabledDebug");
markFlagAsAccessed(31, "fuseboxEnabledDebug");
flagValue = currentProvider_->fuseboxEnabledDebug();
fuseboxEnabledDebug_ = flagValue;
@@ -596,7 +614,7 @@ bool ReactNativeFeatureFlagsAccessor::fuseboxEnabledRelease() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(31, "fuseboxEnabledRelease");
markFlagAsAccessed(32, "fuseboxEnabledRelease");
flagValue = currentProvider_->fuseboxEnabledRelease();
fuseboxEnabledRelease_ = flagValue;
@@ -614,7 +632,7 @@ bool ReactNativeFeatureFlagsAccessor::initEagerTurboModulesOnNativeModulesQueueA
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(32, "initEagerTurboModulesOnNativeModulesQueueAndroid");
markFlagAsAccessed(33, "initEagerTurboModulesOnNativeModulesQueueAndroid");
flagValue = currentProvider_->initEagerTurboModulesOnNativeModulesQueueAndroid();
initEagerTurboModulesOnNativeModulesQueueAndroid_ = flagValue;
@@ -632,7 +650,7 @@ bool ReactNativeFeatureFlagsAccessor::lazyAnimationCallbacks() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(33, "lazyAnimationCallbacks");
markFlagAsAccessed(34, "lazyAnimationCallbacks");
flagValue = currentProvider_->lazyAnimationCallbacks();
lazyAnimationCallbacks_ = flagValue;
@@ -650,7 +668,7 @@ bool ReactNativeFeatureFlagsAccessor::loadVectorDrawablesOnImages() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(34, "loadVectorDrawablesOnImages");
markFlagAsAccessed(35, "loadVectorDrawablesOnImages");
flagValue = currentProvider_->loadVectorDrawablesOnImages();
loadVectorDrawablesOnImages_ = flagValue;
@@ -668,7 +686,7 @@ bool ReactNativeFeatureFlagsAccessor::setAndroidLayoutDirection() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(35, "setAndroidLayoutDirection");
markFlagAsAccessed(36, "setAndroidLayoutDirection");
flagValue = currentProvider_->setAndroidLayoutDirection();
setAndroidLayoutDirection_ = flagValue;
@@ -686,7 +704,7 @@ bool ReactNativeFeatureFlagsAccessor::traceTurboModulePromiseRejectionsOnAndroid
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(36, "traceTurboModulePromiseRejectionsOnAndroid");
markFlagAsAccessed(37, "traceTurboModulePromiseRejectionsOnAndroid");
flagValue = currentProvider_->traceTurboModulePromiseRejectionsOnAndroid();
traceTurboModulePromiseRejectionsOnAndroid_ = flagValue;
@@ -704,7 +722,7 @@ bool ReactNativeFeatureFlagsAccessor::useFabricInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(37, "useFabricInterop");
markFlagAsAccessed(38, "useFabricInterop");
flagValue = currentProvider_->useFabricInterop();
useFabricInterop_ = flagValue;
@@ -722,7 +740,7 @@ bool ReactNativeFeatureFlagsAccessor::useImmediateExecutorInAndroidBridgeless()
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(38, "useImmediateExecutorInAndroidBridgeless");
markFlagAsAccessed(39, "useImmediateExecutorInAndroidBridgeless");
flagValue = currentProvider_->useImmediateExecutorInAndroidBridgeless();
useImmediateExecutorInAndroidBridgeless_ = flagValue;
@@ -740,7 +758,7 @@ bool ReactNativeFeatureFlagsAccessor::useModernRuntimeScheduler() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(39, "useModernRuntimeScheduler");
markFlagAsAccessed(40, "useModernRuntimeScheduler");
flagValue = currentProvider_->useModernRuntimeScheduler();
useModernRuntimeScheduler_ = flagValue;
@@ -758,7 +776,7 @@ bool ReactNativeFeatureFlagsAccessor::useNativeViewConfigsInBridgelessMode() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(40, "useNativeViewConfigsInBridgelessMode");
markFlagAsAccessed(41, "useNativeViewConfigsInBridgelessMode");
flagValue = currentProvider_->useNativeViewConfigsInBridgelessMode();
useNativeViewConfigsInBridgelessMode_ = flagValue;
@@ -776,7 +794,7 @@ bool ReactNativeFeatureFlagsAccessor::useNewReactImageViewBackgroundDrawing() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(41, "useNewReactImageViewBackgroundDrawing");
markFlagAsAccessed(42, "useNewReactImageViewBackgroundDrawing");
flagValue = currentProvider_->useNewReactImageViewBackgroundDrawing();
useNewReactImageViewBackgroundDrawing_ = flagValue;
@@ -794,7 +812,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimisedViewPreallocationOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(42, "useOptimisedViewPreallocationOnAndroid");
markFlagAsAccessed(43, "useOptimisedViewPreallocationOnAndroid");
flagValue = currentProvider_->useOptimisedViewPreallocationOnAndroid();
useOptimisedViewPreallocationOnAndroid_ = flagValue;
@@ -812,7 +830,7 @@ bool ReactNativeFeatureFlagsAccessor::useOptimizedEventBatchingOnAndroid() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(43, "useOptimizedEventBatchingOnAndroid");
markFlagAsAccessed(44, "useOptimizedEventBatchingOnAndroid");
flagValue = currentProvider_->useOptimizedEventBatchingOnAndroid();
useOptimizedEventBatchingOnAndroid_ = flagValue;
@@ -830,7 +848,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdate() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(44, "useRuntimeShadowNodeReferenceUpdate");
markFlagAsAccessed(45, "useRuntimeShadowNodeReferenceUpdate");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdate();
useRuntimeShadowNodeReferenceUpdate_ = flagValue;
@@ -848,7 +866,7 @@ bool ReactNativeFeatureFlagsAccessor::useRuntimeShadowNodeReferenceUpdateOnLayou
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(45, "useRuntimeShadowNodeReferenceUpdateOnLayout");
markFlagAsAccessed(46, "useRuntimeShadowNodeReferenceUpdateOnLayout");
flagValue = currentProvider_->useRuntimeShadowNodeReferenceUpdateOnLayout();
useRuntimeShadowNodeReferenceUpdateOnLayout_ = flagValue;
@@ -866,7 +884,7 @@ bool ReactNativeFeatureFlagsAccessor::useStateAlignmentMechanism() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(46, "useStateAlignmentMechanism");
markFlagAsAccessed(47, "useStateAlignmentMechanism");
flagValue = currentProvider_->useStateAlignmentMechanism();
useStateAlignmentMechanism_ = flagValue;
@@ -884,7 +902,7 @@ bool ReactNativeFeatureFlagsAccessor::useTurboModuleInterop() {
// be accessing the provider multiple times but the end state of this
// instance and the returned flag value would be the same.
markFlagAsAccessed(47, "useTurboModuleInterop");
markFlagAsAccessed(48, "useTurboModuleInterop");
flagValue = currentProvider_->useTurboModuleInterop();
useTurboModuleInterop_ = flagValue;
@@ -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<<ef12745c7462250933c3198115418393>>
* @generated SignedSource<<7943d0be377deed21ddec9964d952db9>>
*/
/**
@@ -37,6 +37,7 @@ class ReactNativeFeatureFlagsAccessor {
bool completeReactInstanceCreationOnBgThreadOnAndroid();
bool destroyFabricSurfacesInReactInstanceManager();
bool enableAlignItemsBaselineOnFabricIOS();
bool enableAndroidLineHeightCentering();
bool enableAndroidMixBlendModeProp();
bool enableBackgroundStyleApplicator();
bool enableCleanTextInputYogaNode();
@@ -89,7 +90,7 @@ class ReactNativeFeatureFlagsAccessor {
std::unique_ptr<ReactNativeFeatureFlagsProvider> currentProvider_;
bool wasOverridden_;
std::array<std::atomic<const char*>, 48> accessedFeatureFlags_;
std::array<std::atomic<const char*>, 49> accessedFeatureFlags_;
std::atomic<std::optional<bool>> commonTestFlag_;
std::atomic<std::optional<bool>> allowRecursiveCommitsWithSynchronousMountOnAndroid_;
@@ -97,6 +98,7 @@ class ReactNativeFeatureFlagsAccessor {
std::atomic<std::optional<bool>> completeReactInstanceCreationOnBgThreadOnAndroid_;
std::atomic<std::optional<bool>> destroyFabricSurfacesInReactInstanceManager_;
std::atomic<std::optional<bool>> enableAlignItemsBaselineOnFabricIOS_;
std::atomic<std::optional<bool>> enableAndroidLineHeightCentering_;
std::atomic<std::optional<bool>> enableAndroidMixBlendModeProp_;
std::atomic<std::optional<bool>> enableBackgroundStyleApplicator_;
std::atomic<std::optional<bool>> enableCleanTextInputYogaNode_;
@@ -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<<2a078848517574213e02b42dff1af8e8>>
* @generated SignedSource<<cc7780d72b0241440e7f4ecb3212a0b8>>
*/
/**
@@ -51,6 +51,10 @@ class ReactNativeFeatureFlagsDefaults : public ReactNativeFeatureFlagsProvider {
return true;
}
bool enableAndroidLineHeightCentering() override {
return false;
}
bool enableAndroidMixBlendModeProp() override {
return 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<<4adf3f21c8c7e370aa59bc79937e91a2>>
* @generated SignedSource<<4731cdde78972b5a0fac6dffc7c1673e>>
*/
/**
@@ -31,6 +31,7 @@ class ReactNativeFeatureFlagsProvider {
virtual bool completeReactInstanceCreationOnBgThreadOnAndroid() = 0;
virtual bool destroyFabricSurfacesInReactInstanceManager() = 0;
virtual bool enableAlignItemsBaselineOnFabricIOS() = 0;
virtual bool enableAndroidLineHeightCentering() = 0;
virtual bool enableAndroidMixBlendModeProp() = 0;
virtual bool enableBackgroundStyleApplicator() = 0;
virtual bool enableCleanTextInputYogaNode() = 0;
@@ -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<<1307630df6aff0acdb4f587465785a09>>
* @generated SignedSource<<dcef79032ef43fce2de3e3f12f6e38bc>>
*/
/**
@@ -67,6 +67,11 @@ bool NativeReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS(
return ReactNativeFeatureFlags::enableAlignItemsBaselineOnFabricIOS();
}
bool NativeReactNativeFeatureFlags::enableAndroidLineHeightCentering(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableAndroidLineHeightCentering();
}
bool NativeReactNativeFeatureFlags::enableAndroidMixBlendModeProp(
jsi::Runtime& /*runtime*/) {
return ReactNativeFeatureFlags::enableAndroidMixBlendModeProp();
@@ -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<<7e65025b9bdd8b515b31f02d2a1489b1>>
* @generated SignedSource<<653edeb6896f7803d7617b330b23683f>>
*/
/**
@@ -47,6 +47,8 @@ class NativeReactNativeFeatureFlags
bool enableAlignItemsBaselineOnFabricIOS(jsi::Runtime& runtime);
bool enableAndroidLineHeightCentering(jsi::Runtime& runtime);
bool enableAndroidMixBlendModeProp(jsi::Runtime& runtime);
bool enableBackgroundStyleApplicator(jsi::Runtime& runtime);
@@ -64,6 +64,11 @@ const definitions: FeatureFlagDefinitions = {
description:
'Kill-switch to turn off support for aling-items:baseline on Fabric iOS.',
},
enableAndroidLineHeightCentering: {
defaultValue: false,
description:
'When enabled, custom line height calculation will be centered from top to bottom.',
},
enableAndroidMixBlendModeProp: {
defaultValue: false,
description: 'Enables mix-blend-mode prop on Android.',
@@ -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<<ea4c7d3691081d2eb90a4041defd7d44>>
* @generated SignedSource<<20de2dddd88f49d4f3a6491ca5c2fe6f>>
* @flow strict-local
*/
@@ -52,6 +52,7 @@ export type ReactNativeFeatureFlags = {
completeReactInstanceCreationOnBgThreadOnAndroid: Getter<boolean>,
destroyFabricSurfacesInReactInstanceManager: Getter<boolean>,
enableAlignItemsBaselineOnFabricIOS: Getter<boolean>,
enableAndroidLineHeightCentering: Getter<boolean>,
enableAndroidMixBlendModeProp: Getter<boolean>,
enableBackgroundStyleApplicator: Getter<boolean>,
enableCleanTextInputYogaNode: Getter<boolean>,
@@ -190,6 +191,10 @@ export const destroyFabricSurfacesInReactInstanceManager: Getter<boolean> = crea
* Kill-switch to turn off support for aling-items:baseline on Fabric iOS.
*/
export const enableAlignItemsBaselineOnFabricIOS: Getter<boolean> = createNativeFlagGetter('enableAlignItemsBaselineOnFabricIOS', true);
/**
* When enabled, custom line height calculation will be centered from top to bottom.
*/
export const enableAndroidLineHeightCentering: Getter<boolean> = createNativeFlagGetter('enableAndroidLineHeightCentering', false);
/**
* Enables mix-blend-mode prop on Android.
*/
@@ -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<<6d4aa48dfdd3b78ac5f0f8e70eb3895f>>
* @generated SignedSource<<901a2d15357b642b74edcf588e35de40>>
* @flow strict-local
*/
@@ -29,6 +29,7 @@ export interface Spec extends TurboModule {
+completeReactInstanceCreationOnBgThreadOnAndroid?: () => boolean;
+destroyFabricSurfacesInReactInstanceManager?: () => boolean;
+enableAlignItemsBaselineOnFabricIOS?: () => boolean;
+enableAndroidLineHeightCentering?: () => boolean;
+enableAndroidMixBlendModeProp?: () => boolean;
+enableBackgroundStyleApplicator?: () => boolean;
+enableCleanTextInputYogaNode?: () => boolean;