Skip to content

Commit dab4cf1

Browse files
javachemeta-codesync[bot]
authored andcommitted
Fix font-scale invalidation for mounted text inputs (#59492)
Summary: Pull Request resolved: #59492 Restart ancestor invalidation when a measurable clone was already dirtied before it had an owner. Correct the default and capped TextInput expectations from stale cached bounds to the bounds of a fresh mount at the expected scale. Changelog: [General][Fixed] - Remeasure text inputs after font scale changes when parent layout constraints are unchanged. Reviewed By: christophpurrer Differential Revision: D127571972
1 parent e205640 commit dab4cf1

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

‎packages/react-native/Libraries/Text/__tests__/FontScale-itest.js‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@ const cases = [
2525
allowFontScaling: undefined,
2626
maxFontSizeMultiplier: undefined,
2727
expectedMultiplier: 2,
28-
// Known bug: TextInput keeps its cached size; this should be 2.
29-
expectedTextInputMultiplier: 1,
28+
expectedTextInputMultiplier: 2,
3029
},
3130
{
3231
name: 'disabled font scaling',
@@ -40,8 +39,7 @@ const cases = [
4039
allowFontScaling: undefined,
4140
maxFontSizeMultiplier: 1.5,
4241
expectedMultiplier: 1.5,
43-
// Known bug: TextInput keeps its cached size; this should be 1.5.
44-
expectedTextInputMultiplier: 1,
42+
expectedTextInputMultiplier: 1.5,
4543
},
4644
];
4745

‎packages/react-native/ReactCommon/react/renderer/components/view/YogaLayoutableShadowNode.cpp‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -564,6 +564,8 @@ void YogaLayoutableShadowNode::configureYogaTree(
564564
if (getTraits().check(ShadowNodeTraits::Trait::MeasurableYogaNode) &&
565565
!floatEquality(
566566
getLayoutMetrics().fontSizeMultiplier, fontSizeMultiplier)) {
567+
// Cloning can dirty the node before it has an owner; restart propagation.
568+
yogaNode_.setDirty(false);
567569
yogaNode_.markDirtyAndPropagate();
568570
}
569571

0 commit comments

Comments
 (0)