mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Fix TextMeasureCacheKey Throwing Out Some LayoutConstraints (#48525)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/48525 Fixes https://github.com/facebook/react-native/issues/48249 `TextMeasureCacheKey` hash and equality functions only incorporates the maximum width constraint. I'm guessing this was an attempt at an optimization, but it can lead to incorrect results in pretty trivial cases. E.g. if Yoga knows a definite size of `Text` in one dimension, and measures via `YGMeasureModeExactly`, we can have a minimum size corresponding specific to the style in which the text was laid out. Changelog: [General][Fixed] - Fix TextMeasureCacheKey Throwing Out Some LayoutConstraints Reviewed By: christophpurrer Differential Revision: D67922414 fbshipit-source-id: 0ee0220059fc4e4645b1684c42a0587fe728bedd
This commit is contained in:
committed by
Facebook GitHub Bot
parent
85e58f334e
commit
f7a5db3c06
+2
-3
@@ -208,8 +208,7 @@ inline bool operator==(
|
||||
return areAttributedStringsEquivalentLayoutWise(
|
||||
lhs.attributedString, rhs.attributedString) &&
|
||||
lhs.paragraphAttributes == rhs.paragraphAttributes &&
|
||||
lhs.layoutConstraints.maximumSize.width ==
|
||||
rhs.layoutConstraints.maximumSize.width;
|
||||
lhs.layoutConstraints == rhs.layoutConstraints;
|
||||
}
|
||||
|
||||
inline bool operator!=(
|
||||
@@ -243,7 +242,7 @@ struct hash<facebook::react::TextMeasureCacheKey> {
|
||||
return facebook::react::hash_combine(
|
||||
attributedStringHashLayoutWise(key.attributedString),
|
||||
key.paragraphAttributes,
|
||||
key.layoutConstraints.maximumSize.width);
|
||||
key.layoutConstraints);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user