Repository navigation
Measure a node connected by enableMeasurement() again when its props or the font scale change - #60583
Open
YevheniiKotyrlo wants to merge 1 commit into
Conversation
…or the font scale change completeClone() and configureYogaTree() read the MeasurableYogaNode trait to decide whether a node is measured, and enableMeasurement() connects the measure function without it. Both now read the Yoga node's measure function. A case in ViewTest.cpp pins both paths. Signed-off-by: YevheniiKotyrlo <44449990+YevheniiKotyrlo@users.noreply.github.com>
This was referenced Dec 4, 2026
YevheniiKotyrlo
marked this pull request as ready for review
December 5, 2026 01:11
This was referenced Dec 5, 2026
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary:
YogaLayoutableShadowNode::enableMeasurement()connects Yoga's measure function and sets no trait, while the two places that dirty a node for its measurement check theMeasurableYogaNodetrait, not the measure function:completeClone(), for a clone whose new revision invalidates its measurement;configureYogaTree(), for a node whosefontSizeMultiplierchanges.A node measured through
enableMeasurement()alone is therefore not dirtied when a new revision invalidates its measurement without changing its Yoga style, nor when the font scale changes, unless its component dirties it otherwise. Both conditions now readyogaNode_.hasMeasureFunc(), which holds for a node connected either way.Related: #60571 adds
enableBaseline()besideenableMeasurement(); #60572 addsgetLayoutMargins(); #60578 correctsenableMeasurement()'s comment; #60581 passes the source revision to theshouldNewRevisionDirtyMeasurement()call in this condition ofcompleteClone(). All four merge with this one without conflict. #59048 and #59139 add tests toViewTest.cpptoo; their changes to it merge with this one's without conflict.Changelog:
[GENERAL] [FIXED] - Measure a node connected by
enableMeasurement()again when its props or the font scale changeTest Plan:
FontScaleLayoutTest.enableMeasurementNodeIsMeasuredAgainOnPropsAndFontScaleChangesis new inViewTest.cpp. Inreactnativecommunity/react-native-android:latestwith clang 18.1.8:-R 'components/view/tests/':100% tests passed, 0 tests failed out of 113mainwith the new test alone,-R 'FontScaleLayoutTest\.enableMeasurementNode': fails;layoutIfNeeded()returnsfalseafter the props clone, and at font scale 1.5 the leaf keeps afontSizeMultiplierof 1 and a height of 10completeClone()reading the trait again, same regex: fails at the props clone aloneconfigureYogaTree()reading the trait again, same regex: fails at font scale 1.5 alonenode ./scripts/clang-format.jsleaves the two changed files unchanged.Not run here: the other CI jobs, among them
testReactCommon's other suites, the Fantom tests, the Android and iOS builds, the C++ API snapshot validation and the format check.