A framework for building native applications using React
Add `experimental_layoutConformance` prop (#38746)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/38746 This adds a view prop which controls the layout conformance of it and its transitive children (including non-view ShadowNodes). The implementation here is to traverse down before layout, updating any context-specific configuration. Normally at the time of layout, unchanged child ShadowNodes are already sealed. These must be mutated already if layout results change, and we do this today via Yoga node clone callback, where Yoga clones nodes where it will do layout work (but not all of them). We down-propagate configuration, but can terminate if we observe an already sealed node whose values match those of our current context, since any nodes under must also follow the same contexts (or any nested contexts of the sealed node). This means that calling `layoutTree()` on a mostly clean ShadowTree will cause configuration to not traverse most nodes. `Errata` and `PointScaleFactor` (DPI) are threaded to each Node's per-node config. The same values are retained when Yoga nodes are cloned (by cloning the ShadowNode). Since these are set before the first layout, config setting should only ever dirty layout [when layout-effecting values change](https://www.internalfb.com/code/fbsource/[1c95e981c740]/xplat/yoga/yoga/YGConfig.cpp?lines=13). The prop is prefixed with `experimental` because we are likely to make more breaking conformance fixes in the strict mode, and I'm not sure this is the final API yet. I was previously looking at a context-like component which is more challenging to implement. Changelog: [Internal] bypass-github-export-checks Reviewed By: rozele, sammy-SC Differential Revision: D47940100 fbshipit-source-id: f72e1c73f537e0312c2bba19ae8c2e882c82aced
N
Nick Gerleman committed
f965da97f3cc45e34fd946ea34181dcaeba03f05
Parent: 0e69050
Committed by Facebook GitHub Bot <facebook-github-bot@users.noreply.github.com>
on 8/8/2023, 2:37:41 AM