mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
8684ef499f
Summary: This implements the `MeasurableYogaNode` trait in `YogaLayoutableShadowNode`. We had this trait from the very beginning but never used it. Now, if the trait is specified, `YogaLayoutableShadowNode` will set the measure function for the node and dirty it during cloning. Previously, we used (and still use) a dedicated method for setting up the measure function - `YogaLayoutableShadowNode::enableMeasurement()`. The problem with it is that to make it work we have to dirty the Yoga node every time we clone it. And the only proper way to do this in the `YogaLayoutableShadowNode` constructor because if we do it later ancestor nodes could not observe this and react to this. Therefore we have to have a trait for it. The plan is to use it for TextInput first to fix a crash (see the next diff). After we confirm it works fine, we will replace all the usages of `enableMeasurement` with the new trait. This diff also renames the other two yoga-related traits (to make them less verbose and look unified), adds more comments, and asserts. Changelog: [Internal] Fabric-specific internal change. Reviewed By: sammy-SC Differential Revision: D25937711 fbshipit-source-id: fafbd5d62537ac09e02ffbfd56adab6d629d791d