mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fixed - Text with adjustsFontSizeToFit changes the text layout infinitely (#33135)
Summary:
Fixes the infinite loop explained in the issue https://github.com/facebook/react-native/issues/33129 by reverting commit 59021521e7. PR https://github.com/facebook/react-native/pull/31538.
`onCollectExtraUpdates` is part of the node update cycle. By marking the node as updated `markUpdated()` in `onCollectExtraUpdates` we are restarting the update infinitely.
Unfortunately, reverting this PR also reintroduces the original issue https://github.com/facebook/react-native/issues/30717 which IMO is minor compared to the infinite loop.
## Changelog
<!-- Help reviewers and the release process by writing your own changelog entry. For an example, see:
https://github.com/facebook/react-native/wiki/Changelog
-->
[Android] [Fixed] - Text with adjustsFontSizeToFit changes the text layout infinitely
Pull Request resolved: https://github.com/facebook/react-native/pull/33135
Test Plan:
I added a console.log to the Text `onTextLayout` in [packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js ](https://github.com/facebook/react-native/blob/main/packages/rn-tester/js/examples/Text/TextAdjustsDynamicLayoutExample.js) to see if the infinite loop is gone.


```
Reviewed By: ShikaSD
Differential Revision: D34310218
Pulled By: lunaleaps
fbshipit-source-id: 0d40f49d15c562ec25983145897bd95dc182f897
This commit is contained in:
committed by
Andrei Shikov
parent
48f9733867
commit
54f5c8c26c
@@ -343,11 +343,6 @@ public class ReactTextShadowNode extends ReactBaseTextShadowNode {
|
||||
mJustificationMode);
|
||||
uiViewOperationQueue.enqueueUpdateExtraData(getReactTag(), reactTextUpdate);
|
||||
}
|
||||
|
||||
if (mAdjustsFontSizeToFit) {
|
||||
// Nodes with `adjustsFontSizeToFit` enabled need to be remeasured on every relayout.
|
||||
markUpdated();
|
||||
}
|
||||
}
|
||||
|
||||
@ReactProp(name = "onTextLayout")
|
||||
|
||||
Reference in New Issue
Block a user