From d4571bbd799f28fd0d4e27d5d3befc9b0f75166a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Arkadiusz=20Chrab=C4=85szczewski?= Date: Tue, 18 Jul 2023 13:33:29 +0200 Subject: [PATCH] fix: viewable items while list is inverted --- .../src/vendor/react-native/VirtualizedList/index.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js b/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js index 2fa5b8d58..5c4196dc4 100644 --- a/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js +++ b/packages/react-native-web/src/vendor/react-native/VirtualizedList/index.js @@ -1424,14 +1424,23 @@ class VirtualizedList extends React.PureComponent { } }; + _selectClientLength(parentNode) { + return !horizontalOrDefault(this.props.horizontal) ? parentNode.clientHeight : parentNode.clientWidth; + } + _onCellLayout(e, cellKey, index) { const layout = e.nativeEvent.layout; + const target = e.nativeEvent.target; const next = { offset: this._selectOffset(layout), length: this._selectLength(layout), index, inLayout: true, }; + + if (this.props.inverted) { + next.offset = this._selectClientLength(target.parentNode) - next.offset - next.length; + } const curr = this._frames[cellKey]; if ( !curr ||