From d38957468a97b9e3a0e894392d882ac77dcb453d Mon Sep 17 00:00:00 2001 From: Wiktor Gut Date: Wed, 16 Apr 2025 12:16:41 +0200 Subject: [PATCH] fix simultaneous scrolling in two directions --- ...+009+fix-two-direction-scroll-on-web.patch | 37 +++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 patches/react-native-web+0.19.13+009+fix-two-direction-scroll-on-web.patch diff --git a/patches/react-native-web+0.19.13+009+fix-two-direction-scroll-on-web.patch b/patches/react-native-web+0.19.13+009+fix-two-direction-scroll-on-web.patch new file mode 100644 index 0000000000000..edb2abba32bc5 --- /dev/null +++ b/patches/react-native-web+0.19.13+009+fix-two-direction-scroll-on-web.patch @@ -0,0 +1,37 @@ +diff --git a/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js b/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js +index 1b8a228..1efeb14 100644 +--- a/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js ++++ b/node_modules/react-native-web/dist/vendor/react-native/VirtualizedList/index.js +@@ -719,21 +719,22 @@ class VirtualizedList extends StateSafePureComponent { + const targetDelta = delta - leftoverDelta; + if (this.props.inverted && this._scrollRef && this._scrollRef.getScrollableNode) { + const node = this._scrollRef.getScrollableNode(); +- if (isHorizontal) { +- ev.target.scrollLeft += targetDelta; +- const nextScrollLeft = node.scrollLeft - leftoverDelta; +- node.scrollLeft = !this.props.getItemLayout ? Math.min(nextScrollLeft, this._totalCellLength) : nextScrollLeft; + ++ if (isHorizontal) { + if (Math.abs(deltaX) > Math.abs(deltaY)) { +- ev.preventDefault(); ++ ev.target.scrollLeft += targetDelta; ++ const nextScrollLeft = node.scrollLeft - leftoverDelta; ++ node.scrollLeft = !this.props.getItemLayout ? Math.min(nextScrollLeft, this._totalCellLength) : nextScrollLeft; ++ ev.preventDefault(); ++ ev.stopPropagation(); + } + } else { +- ev.target.scrollTop += targetDelta; +- const nextScrollTop = node.scrollTop - leftoverDelta; +- node.scrollTop = !this.props.getItemLayout ? Math.min(nextScrollTop, this._totalCellLength) : nextScrollTop; +- + if (Math.abs(deltaY) > Math.abs(deltaX)) { +- ev.preventDefault(); ++ ev.target.scrollTop += targetDelta; ++ const nextScrollTop = node.scrollTop - leftoverDelta; ++ node.scrollTop = !this.props.getItemLayout ? Math.min(nextScrollTop, this._totalCellLength) : nextScrollTop; ++ ev.preventDefault(); ++ ev.stopPropagation(); + } + } + }