Files
react-native/packages
Tim Yung d6ed32f8d6 VirtualView: Configurable Hidden Layout (#53571)
Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/53571

Changes `VirtualView` so that its layout when hidden can be configured by call sites.

Previously, it was hardcoded to only retain the last known height. However, this logic only works for `VirtualView` children oriented in a column layout.

This change enables the use of `VirtualView` in more flexible abstractions that require different hidden styles (e.g. row or grid orientations).

Also, this changes the default behavior to set `minWidth` and `minHeight`, so that the default behavior is more general and more likely to work in a reasonable manner in more use cases.

NOTE: Ideally, we would be able to default to using `flexBasis` instead. However, the `hiddenStyle` function receives a `Rect` and does not know whether the parent's flex direction is row or column to influence whether to use `targetRect.width` or `targetRect.height`. This is an opportunity for future improvement.

Changelog:
[Internal]

Reviewed By: lunaleaps

Differential Revision: D81344126

fbshipit-source-id: 33d9e81601b671059f97b4590816243cbd24734a
2025-09-02 16:28:02 -07:00
..