Skip to content

Commit e53b76b

Browse files
NickGerlemanfacebook-github-bot
authored andcommitted
Cleanup enableAndroidLineHeightCentering flag (facebook#48577)
Summary: Pull Request resolved: facebook#48577 This has been enabled by default for about two and a half months. Let's clean up the old path. Changelog: [Internal] Reviewed By: javache Differential Revision: D67985133 fbshipit-source-id: 024c1b3f10d7d23caba04ed4b6eec122de1a7c14
1 parent 2ab9a8c commit e53b76b

24 files changed

+65
-271
lines changed

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

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

1010
/**
@@ -58,12 +58,6 @@ public object ReactNativeFeatureFlags {
5858
@JvmStatic
5959
public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = accessor.enableAccumulatedUpdatesInRawPropsAndroid()
6060

61-
/**
62-
* When enabled, custom line height calculation will be centered from top to bottom.
63-
*/
64-
@JvmStatic
65-
public fun enableAndroidLineHeightCentering(): Boolean = accessor.enableAndroidLineHeightCentering()
66-
6761
/**
6862
* Feature flag to enable the new bridgeless architecture. Note: Enabling this will force enable the following flags: `useTurboModules` & `enableFabricRenderer.
6963
*/

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

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

1010
/**
@@ -25,7 +25,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
2525
private var disableEventLoopOnBridgelessCache: Boolean? = null
2626
private var disableMountItemReorderingAndroidCache: Boolean? = null
2727
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
28-
private var enableAndroidLineHeightCenteringCache: Boolean? = null
2928
private var enableBridgelessArchitectureCache: Boolean? = null
3029
private var enableCppPropsIteratorSetterCache: Boolean? = null
3130
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
@@ -112,15 +111,6 @@ public class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAccesso
112111
return cached
113112
}
114113

115-
override fun enableAndroidLineHeightCentering(): Boolean {
116-
var cached = enableAndroidLineHeightCenteringCache
117-
if (cached == null) {
118-
cached = ReactNativeFeatureFlagsCxxInterop.enableAndroidLineHeightCentering()
119-
enableAndroidLineHeightCenteringCache = cached
120-
}
121-
return cached
122-
}
123-
124114
override fun enableBridgelessArchitecture(): Boolean {
125115
var cached = enableBridgelessArchitectureCache
126116
if (cached == null) {

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

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

1010
/**
@@ -38,8 +38,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
3838

3939
@DoNotStrip @JvmStatic public external fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
4040

41-
@DoNotStrip @JvmStatic public external fun enableAndroidLineHeightCentering(): Boolean
42-
4341
@DoNotStrip @JvmStatic public external fun enableBridgelessArchitecture(): Boolean
4442

4543
@DoNotStrip @JvmStatic public external fun enableCppPropsIteratorSetter(): Boolean

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

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

1010
/**
@@ -33,8 +33,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
3333

3434
override fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean = false
3535

36-
override fun enableAndroidLineHeightCentering(): Boolean = true
37-
3836
override fun enableBridgelessArchitecture(): Boolean = false
3937

4038
override fun enableCppPropsIteratorSetter(): Boolean = false

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

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

1010
/**
@@ -29,7 +29,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
2929
private var disableEventLoopOnBridgelessCache: Boolean? = null
3030
private var disableMountItemReorderingAndroidCache: Boolean? = null
3131
private var enableAccumulatedUpdatesInRawPropsAndroidCache: Boolean? = null
32-
private var enableAndroidLineHeightCenteringCache: Boolean? = null
3332
private var enableBridgelessArchitectureCache: Boolean? = null
3433
private var enableCppPropsIteratorSetterCache: Boolean? = null
3534
private var enableDeletionOfUnmountedViewsCache: Boolean? = null
@@ -121,16 +120,6 @@ public class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcces
121120
return cached
122121
}
123122

124-
override fun enableAndroidLineHeightCentering(): Boolean {
125-
var cached = enableAndroidLineHeightCenteringCache
126-
if (cached == null) {
127-
cached = currentProvider.enableAndroidLineHeightCentering()
128-
accessedFeatureFlags.add("enableAndroidLineHeightCentering")
129-
enableAndroidLineHeightCenteringCache = cached
130-
}
131-
return cached
132-
}
133-
134123
override fun enableBridgelessArchitecture(): Boolean {
135124
var cached = enableBridgelessArchitectureCache
136125
if (cached == null) {

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

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

1010
/**
@@ -33,8 +33,6 @@ public interface ReactNativeFeatureFlagsProvider {
3333

3434
@DoNotStrip public fun enableAccumulatedUpdatesInRawPropsAndroid(): Boolean
3535

36-
@DoNotStrip public fun enableAndroidLineHeightCentering(): Boolean
37-
3836
@DoNotStrip public fun enableBridgelessArchitecture(): Boolean
3937

4038
@DoNotStrip public fun enableCppPropsIteratorSetter(): Boolean

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/ReactBaseTextShadowNode.java

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@
2121
import com.facebook.react.bridge.ReadableArray;
2222
import com.facebook.react.bridge.ReadableMap;
2323
import com.facebook.react.common.ReactConstants;
24-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
2524
import com.facebook.react.uimanager.IllegalViewOperationException;
2625
import com.facebook.react.uimanager.LayoutShadowNode;
2726
import com.facebook.react.uimanager.NativeViewHierarchyOptimizer;
@@ -35,7 +34,6 @@
3534
import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan;
3635
import com.facebook.react.views.text.internal.span.CustomLineHeightSpan;
3736
import com.facebook.react.views.text.internal.span.CustomStyleSpan;
38-
import com.facebook.react.views.text.internal.span.LegacyLineHeightSpan;
3937
import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan;
4038
import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan;
4139
import com.facebook.react.views.text.internal.span.ReactClickableSpan;
@@ -231,11 +229,7 @@ private static void buildSpannedFromShadowNode(
231229
if (!Float.isNaN(effectiveLineHeight)
232230
&& (parentTextAttributes == null
233231
|| parentTextAttributes.getEffectiveLineHeight() != effectiveLineHeight)) {
234-
if (ReactNativeFeatureFlags.enableAndroidLineHeightCentering()) {
235-
ops.add(new SetSpanOperation(start, end, new CustomLineHeightSpan(effectiveLineHeight)));
236-
} else {
237-
ops.add(new SetSpanOperation(start, end, new LegacyLineHeightSpan(effectiveLineHeight)));
238-
}
232+
ops.add(new SetSpanOperation(start, end, new CustomLineHeightSpan(effectiveLineHeight)));
239233
}
240234
ops.add(new SetSpanOperation(start, end, new ReactTagSpan(textShadowNode.getReactTag())));
241235
}

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/TextLayoutManager.java

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -32,14 +32,12 @@
3232
import com.facebook.react.common.ReactConstants;
3333
import com.facebook.react.common.build.ReactBuildConfig;
3434
import com.facebook.react.common.mapbuffer.MapBuffer;
35-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
3635
import com.facebook.react.uimanager.PixelUtil;
3736
import com.facebook.react.uimanager.ReactAccessibilityDelegate.AccessibilityRole;
3837
import com.facebook.react.uimanager.ReactAccessibilityDelegate.Role;
3938
import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan;
4039
import com.facebook.react.views.text.internal.span.CustomLineHeightSpan;
4140
import com.facebook.react.views.text.internal.span.CustomStyleSpan;
42-
import com.facebook.react.views.text.internal.span.LegacyLineHeightSpan;
4341
import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan;
4442
import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan;
4543
import com.facebook.react.views.text.internal.span.ReactClickableSpan;
@@ -319,15 +317,9 @@ private static void buildSpannableFromFragments(
319317
textAttributes.mTextShadowColor)));
320318
}
321319
if (!Float.isNaN(textAttributes.getEffectiveLineHeight())) {
322-
if (ReactNativeFeatureFlags.enableAndroidLineHeightCentering()) {
323-
ops.add(
324-
new SetSpanOperation(
325-
start, end, new CustomLineHeightSpan(textAttributes.getEffectiveLineHeight())));
326-
} else {
327-
ops.add(
328-
new SetSpanOperation(
329-
start, end, new LegacyLineHeightSpan(textAttributes.getEffectiveLineHeight())));
330-
}
320+
ops.add(
321+
new SetSpanOperation(
322+
start, end, new CustomLineHeightSpan(textAttributes.getEffectiveLineHeight())));
331323
}
332324

333325
ops.add(new SetSpanOperation(start, end, new ReactTagSpan(reactTag)));

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/text/internal/span/LegacyLineHeightSpan.kt

Lines changed: 0 additions & 69 deletions
This file was deleted.

packages/react-native/ReactAndroid/src/main/java/com/facebook/react/views/textinput/ReactEditText.java

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
import com.facebook.react.bridge.ReactSoftExceptionLogger;
5151
import com.facebook.react.common.ReactConstants;
5252
import com.facebook.react.common.build.ReactBuildConfig;
53-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags;
5453
import com.facebook.react.uimanager.BackgroundStyleApplicator;
5554
import com.facebook.react.uimanager.LengthPercentage;
5655
import com.facebook.react.uimanager.LengthPercentageType;
@@ -72,7 +71,6 @@
7271
import com.facebook.react.views.text.internal.span.CustomLetterSpacingSpan;
7372
import com.facebook.react.views.text.internal.span.CustomLineHeightSpan;
7473
import com.facebook.react.views.text.internal.span.CustomStyleSpan;
75-
import com.facebook.react.views.text.internal.span.LegacyLineHeightSpan;
7674
import com.facebook.react.views.text.internal.span.ReactAbsoluteSizeSpan;
7775
import com.facebook.react.views.text.internal.span.ReactBackgroundColorSpan;
7876
import com.facebook.react.views.text.internal.span.ReactForegroundColorSpan;
@@ -873,13 +871,7 @@ private void addSpansFromStyleAttributes(SpannableStringBuilder workingText) {
873871

874872
float lineHeight = mTextAttributes.getEffectiveLineHeight();
875873
if (!Float.isNaN(lineHeight)) {
876-
if (ReactNativeFeatureFlags.enableAndroidLineHeightCentering()) {
877-
workingText.setSpan(
878-
new CustomLineHeightSpan(lineHeight), 0, workingText.length(), spanFlags);
879-
} else {
880-
workingText.setSpan(
881-
new LegacyLineHeightSpan(lineHeight), 0, workingText.length(), spanFlags);
882-
}
874+
workingText.setSpan(new CustomLineHeightSpan(lineHeight), 0, workingText.length(), spanFlags);
883875
}
884876
}
885877

0 commit comments

Comments
 (0)