Skip to content

Commit b2ab644

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 4251882 commit b2ab644

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
@@ -24,8 +24,7 @@ const cases = [
2424
allowFontScaling: undefined,
2525
maxFontSizeMultiplier: undefined,
2626
expectedMultiplier: 2,
27-
// Known bug: TextInput keeps its cached size; this should be 2.
28-
expectedTextInputMultiplier: 1,
27+
expectedTextInputMultiplier: 2,
2928
},
3029
{
3130
name: 'disabled font scaling',
@@ -39,8 +38,7 @@ const cases = [
3938
allowFontScaling: undefined,
4039
maxFontSizeMultiplier: 1.5,
4140
expectedMultiplier: 1.5,
42-
// Known bug: TextInput keeps its cached size; this should be 1.5.
43-
expectedTextInputMultiplier: 1,
41+
expectedTextInputMultiplier: 1.5,
4442
},
4543
];
4644

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -508,6 +508,8 @@ void YogaLayoutableShadowNode::configureYogaTree(
508508
getTraits().check(ShadowNodeTraits::Trait::MeasurableYogaNode) &&
509509
!floatEquality(
510510
getLayoutMetrics().fontSizeMultiplier, fontSizeMultiplier)) {
511+
// Cloning can dirty the node before it has an owner; restart propagation.
512+
yogaNode_.setDirty(false);
511513
yogaNode_.markDirtyAndPropagate();
512514
}
513515

0 commit comments

Comments
 (0)