react-native
react-native copied to clipboard
Automatically disable flattening of scroll content view children when needed
Summary: There are a couple scenarios where flattening the child of a ScrollView can cause problems.
-
maintainVisibleContentPositionon both Android and iOS rely on reading live positions in the view tree -
snapToAlignmenton Android uses live view tree, for items to snap to. iOS seems to have very different behavior, and aligns assuming that children are scroll view height, or that a snap interval has been set.
This change adds a prop collapsableChildren which can be used to disable children of scroll content view from being collapsed.
Differentiator is... complicated... but we can mostly just adapt the code dealing with existing traits at the surface level.
Differential Revision: D56226241
| Platform | Engine | Arch | Size (bytes) | Diff |
|---|---|---|---|---|
| android | hermes | arm64-v8a | 19,410,732 | -47 |
| android | hermes | armeabi-v7a | n/a | -- |
| android | hermes | x86 | n/a | -- |
| android | hermes | x86_64 | n/a | -- |
| android | jsc | arm64-v8a | 22,784,375 | +78 |
| android | jsc | armeabi-v7a | n/a | -- |
| android | jsc | x86 | n/a | -- |
| android | jsc | x86_64 | n/a | -- |
Base commit: 876914be556ca62d6aa77ec101debf09062b8922 Branch: main
Merged as https://github.com/facebook/react-native/commit/7b44c8d1d0a089a766c7eab1b5435b2dbf61454c