mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
f27621465d
Summary: The is how it works: * Text is a quite special component with special properties and constraints. Some of them are: It's expensive to measure (layout) text. It's expensive to measure and expensive to pass AttributedString via JNI. * When we measure text, we don't concerned about maximum height, only maximum height is important. (Even though theoretically, there are text layout systems that can balance these constraints (max height and width) trying to find a perfect result, we don't use such complex (and expensive) layout engines for building UIs). Yoga, as a flexbox engine, does not aware of such constraints, so it requests remeasuring of text components quite often, so we have an RN built-in text measure cache system just for text measurements that suit these constraints. This way when Yoga requests a text measuring, we always measure with `Inf` height and store that result in the cache. And when Yoga requests another measure with the same width but a different height we retrieve the value from the cache and then just clamp it. Changelog: [Internal] Fabric-specific internal change. Reviewed By: mdvacca Differential Revision: D26696637 fbshipit-source-id: f65b275d33c77073bc2359cbf0a741ddcf05d8d4