Files
react-native/ReactCommon/react/renderer/textlayoutmanager/platform
Valentin Shergin f27621465d Fabric: Fixes in Android TextLayoutManager for better caching performance
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
2021-02-28 08:47:05 -08:00
..
2020-11-05 03:02:03 -08:00
2021-01-09 22:11:00 -08:00