Skip to content

Commit 4b2aef2

Browse files
javachemeta-codesync[bot]
authored andcommitted
Remove enableFontScaleChangesUpdatingLayout (#59389)
Summary: Pull Request resolved: #59389 Font-scale changes already update layout by default. Remove the flag and its disabled paths. Changelog: [Internal] Reviewed By: cipolleschi Differential Revision: D127121998 fbshipit-source-id: a5522c3a98ecce186def1e2e17329166c4acdf25
1 parent 28433d1 commit 4b2aef2

26 files changed

Lines changed: 100 additions & 230 deletions

‎packages/react-native/React/Fabric/Mounting/ComponentViews/TextInput/RCTTextInputComponentView.mm‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -154,9 +154,8 @@ - (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection
154154
{
155155
[super traitCollectionDidChange:previousTraitCollection];
156156

157-
if (facebook::react::ReactNativeFeatureFlags::enableFontScaleChangesUpdatingLayout() &&
158-
UITraitCollection.currentTraitCollection.preferredContentSizeCategory !=
159-
previousTraitCollection.preferredContentSizeCategory) {
157+
if (UITraitCollection.currentTraitCollection.preferredContentSizeCategory !=
158+
previousTraitCollection.preferredContentSizeCategory) {
160159
const auto &newTextInputProps = static_cast<const TextInputProps &>(*_props);
161160
_backedTextInputView.defaultTextAttributes =
162161
RCTNSTextAttributesFromTextAttributes(newTextInputProps.getEffectiveTextAttributes(RCTFontSizeMultiplier()));

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactRootView.java‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,9 +138,7 @@ private void init() {
138138
setRootViewTag(ReactRootViewTagGenerator.getNextRootViewTag());
139139
setClipChildren(false);
140140

141-
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) {
142-
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
143-
}
141+
DisplayMetricsHolder.initDisplayMetrics(getContext().getApplicationContext());
144142
}
145143

146144
@Override

‎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<<f308cce94b6675fb99b66792ba49347a>>
7+
* @generated SignedSource<<a89ede36c4631b7a7709899858a7f9c9>>
88
*/
99

1010
/**
@@ -210,12 +210,6 @@ public object ReactNativeFeatureFlags {
210210
@JvmStatic
211211
public fun enableFollowUpMountItemDispatchAndroid(): Boolean = accessor.enableFollowUpMountItemDispatchAndroid()
212212

213-
/**
214-
* Enables font scale changes updating layout for measurable nodes.
215-
*/
216-
@JvmStatic
217-
public fun enableFontScaleChangesUpdatingLayout(): Boolean = accessor.enableFontScaleChangesUpdatingLayout()
218-
219213
/**
220214
* Adjusts iOS Text drawing frames for compressed explicit line heights.
221215
*/

‎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<<1cefe829b93cd661df195cbf3a3663a7>>
7+
* @generated SignedSource<<cd3b4f6a7fb4e616d3f56ab8c9eb9658>>
88
*/
99

1010
/**
@@ -50,7 +50,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
5050
private var enableFabricLogsCache: Boolean? = null
5151
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
5252
private var enableFollowUpMountItemDispatchAndroidCache: Boolean? = null
53-
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
5453
private var enableIOSCompressedTextFrameAdjustmentCache: Boolean? = null
5554
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
5655
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
@@ -389,15 +388,6 @@ internal class ReactNativeFeatureFlagsCxxAccessor : ReactNativeFeatureFlagsAcces
389388
return cached
390389
}
391390

392-
override fun enableFontScaleChangesUpdatingLayout(): Boolean {
393-
var cached = enableFontScaleChangesUpdatingLayoutCache
394-
if (cached == null) {
395-
cached = ReactNativeFeatureFlagsCxxInterop.enableFontScaleChangesUpdatingLayout()
396-
enableFontScaleChangesUpdatingLayoutCache = cached
397-
}
398-
return cached
399-
}
400-
401391
override fun enableIOSCompressedTextFrameAdjustment(): Boolean {
402392
var cached = enableIOSCompressedTextFrameAdjustmentCache
403393
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<<e984b654c4b8fc17f99046e60306f3f6>>
7+
* @generated SignedSource<<6d86d4adbc261c9271b5bed72bd12dcf>>
88
*/
99

1010
/**
@@ -88,8 +88,6 @@ public object ReactNativeFeatureFlagsCxxInterop {
8888

8989
@DoNotStrip @JvmStatic public external fun enableFollowUpMountItemDispatchAndroid(): Boolean
9090

91-
@DoNotStrip @JvmStatic public external fun enableFontScaleChangesUpdatingLayout(): Boolean
92-
9391
@DoNotStrip @JvmStatic public external fun enableIOSCompressedTextFrameAdjustment(): Boolean
9492

9593
@DoNotStrip @JvmStatic public external fun enableIOSTextBaselineOffsetPerLine(): 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<<c0f98773f7b83272d69132d1a3e2f45a>>
7+
* @generated SignedSource<<a1368426dd823245c54b4312ae7b14e6>>
88
*/
99

1010
/**
@@ -83,8 +83,6 @@ public open class ReactNativeFeatureFlagsDefaults : ReactNativeFeatureFlagsProvi
8383

8484
override fun enableFollowUpMountItemDispatchAndroid(): Boolean = false
8585

86-
override fun enableFontScaleChangesUpdatingLayout(): Boolean = true
87-
8886
override fun enableIOSCompressedTextFrameAdjustment(): Boolean = false
8987

9088
override fun enableIOSTextBaselineOffsetPerLine(): 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<<f18d16c52745abc62a0b9ccad5358a0b>>
7+
* @generated SignedSource<<c305274be2fc6720b6c0eb75e78bd6b0>>
88
*/
99

1010
/**
@@ -54,7 +54,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
5454
private var enableFabricLogsCache: Boolean? = null
5555
private var enableFlexboxAutoMinSizeInStrictModeCache: Boolean? = null
5656
private var enableFollowUpMountItemDispatchAndroidCache: Boolean? = null
57-
private var enableFontScaleChangesUpdatingLayoutCache: Boolean? = null
5857
private var enableIOSCompressedTextFrameAdjustmentCache: Boolean? = null
5958
private var enableIOSTextBaselineOffsetPerLineCache: Boolean? = null
6059
private var enableIOSViewClipToPaddingBoxCache: Boolean? = null
@@ -423,16 +422,6 @@ internal class ReactNativeFeatureFlagsLocalAccessor : ReactNativeFeatureFlagsAcc
423422
return cached
424423
}
425424

426-
override fun enableFontScaleChangesUpdatingLayout(): Boolean {
427-
var cached = enableFontScaleChangesUpdatingLayoutCache
428-
if (cached == null) {
429-
cached = currentProvider.enableFontScaleChangesUpdatingLayout()
430-
accessedFeatureFlags.add("enableFontScaleChangesUpdatingLayout")
431-
enableFontScaleChangesUpdatingLayoutCache = cached
432-
}
433-
return cached
434-
}
435-
436425
override fun enableIOSCompressedTextFrameAdjustment(): Boolean {
437426
var cached = enableIOSCompressedTextFrameAdjustmentCache
438427
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<<0a088b4c798dd44274c63a4aa6cba312>>
7+
* @generated SignedSource<<da45e41e9a58711ee3b68a38965938fb>>
88
*/
99

1010
/**
@@ -83,8 +83,6 @@ public interface ReactNativeFeatureFlagsProvider {
8383

8484
@DoNotStrip public fun enableFollowUpMountItemDispatchAndroid(): Boolean
8585

86-
@DoNotStrip public fun enableFontScaleChangesUpdatingLayout(): Boolean
87-
8886
@DoNotStrip public fun enableIOSCompressedTextFrameAdjustment(): Boolean
8987

9088
@DoNotStrip public fun enableIOSTextBaselineOffsetPerLine(): Boolean

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactHostImpl.kt‎

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -733,15 +733,13 @@ public class ReactHostImpl(
733733
override fun onConfigurationChanged(context: Context) {
734734
val currentReactContext = this.currentReactContext
735735
if (currentReactContext != null) {
736-
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout()) {
737-
val previousFontScale = PixelUtil.toPixelFromSP(1.0)
738-
DisplayMetricsHolder.initDisplayMetrics(currentReactContext)
739-
val newFontScale = PixelUtil.toPixelFromSP(1.0)
740-
741-
if (previousFontScale != newFontScale) {
742-
synchronized(attachedSurfaces) {
743-
attachedSurfaces.forEach { surface -> surface.view?.requestLayout() }
744-
}
736+
val previousFontScale = PixelUtil.toPixelFromSP(1.0)
737+
DisplayMetricsHolder.initDisplayMetrics(currentReactContext)
738+
val newFontScale = PixelUtil.toPixelFromSP(1.0)
739+
740+
if (previousFontScale != newFontScale) {
741+
synchronized(attachedSurfaces) {
742+
attachedSurfaces.forEach { surface -> surface.view?.requestLayout() }
745743
}
746744
}
747745

‎packages/react-native/ReactAndroid/src/main/java/com/facebook/react/runtime/ReactSurfaceImpl.kt‎

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ import com.facebook.react.common.annotations.VisibleForTesting
2323
import com.facebook.react.fabric.SurfaceHandlerBinding
2424
import com.facebook.react.interfaces.TaskInterface
2525
import com.facebook.react.interfaces.fabric.ReactSurface
26-
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
2726
import com.facebook.react.modules.i18nmanager.I18nUtil
2827
import com.facebook.react.runtime.internal.bolts.Task
2928
import com.facebook.react.uimanager.events.EventDispatcher
@@ -216,10 +215,7 @@ internal constructor(
216215

217216
private fun isRTL(context: Context): Boolean = I18nUtil.instance.isRTL(context)
218217

219-
private fun getFontScale(context: Context): Float =
220-
if (ReactNativeFeatureFlags.enableFontScaleChangesUpdatingLayout())
221-
context.resources.configuration.fontScale
222-
else 1f
218+
private fun getFontScale(context: Context): Float = context.resources.configuration.fontScale
223219

224220
private fun doRTLSwap(context: Context): Boolean =
225221
I18nUtil.instance.doLeftAndRightSwapInRTL(context)

0 commit comments

Comments
 (0)