From 022ac3aa5e82618df3d128168e152c0dc7f8b252 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Mon, 11 Dec 2023 13:42:46 +0100 Subject: [PATCH 1/7] fix last spacer --- ...eact-native-web+0.19.9-fixLastSpacer.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 patches/react-native-web+0.19.9-fixLastSpacer.patch diff --git a/patches/react-native-web+0.19.9-fixLastSpacer.patch b/patches/react-native-web+0.19.9-fixLastSpacer.patch new file mode 100644 index 000000000000..75634006f35c --- /dev/null +++ b/patches/react-native-web+0.19.9-fixLastSpacer.patch @@ -0,0 +1,34 @@ +diff --git a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js +index f303b31..748173d 100644 +--- a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js ++++ b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js +@@ -126,19 +126,6 @@ function windowSizeOrDefault(windowSize: ?number) { + return windowSize ?? 21; + } + +-function findLastWhere( +- arr: $ReadOnlyArray, +- predicate: (element: T) => boolean, +-): T | null { +- for (let i = arr.length - 1; i >= 0; i--) { +- if (predicate(arr[i])) { +- return arr[i]; +- } +- } +- +- return null; +-} +- + /** + * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist) + * and [``](https://reactnative.dev/docs/sectionlist) components, which are also better +@@ -1089,7 +1076,8 @@ class VirtualizedList extends StateSafePureComponent { + const spacerKey = this._getSpacerKey(!horizontal); + + const renderRegions = this.state.renderMask.enumerateRegions(); +- const lastSpacer = findLastWhere(renderRegions, r => r.isSpacer); ++ const lastRegion = renderRegions[renderRegions.length - 1]; ++ const lastSpacer = lastRegion?.isSpacer ? lastRegion : null; + + for (const section of renderRegions) { + if (section.isSpacer) { From 462420cae8fb182f4a53d46b46d2b384f09349f0 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Mon, 11 Dec 2023 17:21:28 +0100 Subject: [PATCH 2/7] rename --- ...acer.patch => react-native-web+0.19.9+005+fixLastSpacer.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{react-native-web+0.19.9-fixLastSpacer.patch => react-native-web+0.19.9+005+fixLastSpacer.patch} (100%) diff --git a/patches/react-native-web+0.19.9-fixLastSpacer.patch b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch similarity index 100% rename from patches/react-native-web+0.19.9-fixLastSpacer.patch rename to patches/react-native-web+0.19.9+005+fixLastSpacer.patch From c74d0ef95dd846d8618253eed38de4f5bd3f73ae Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Mon, 11 Dec 2023 17:21:38 +0100 Subject: [PATCH 3/7] the second patch --- ...eact-native+virtualized-lists+0.72.8.patch | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 patches/@react-native+virtualized-lists+0.72.8.patch diff --git a/patches/@react-native+virtualized-lists+0.72.8.patch b/patches/@react-native+virtualized-lists+0.72.8.patch new file mode 100644 index 000000000000..a3bef95f1618 --- /dev/null +++ b/patches/@react-native+virtualized-lists+0.72.8.patch @@ -0,0 +1,34 @@ +diff --git a/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js b/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js +index ef5a3f0..2590edd 100644 +--- a/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js ++++ b/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js +@@ -125,19 +125,6 @@ function windowSizeOrDefault(windowSize: ?number) { + return windowSize ?? 21; + } + +-function findLastWhere( +- arr: $ReadOnlyArray, +- predicate: (element: T) => boolean, +-): T | null { +- for (let i = arr.length - 1; i >= 0; i--) { +- if (predicate(arr[i])) { +- return arr[i]; +- } +- } +- +- return null; +-} +- + /** + * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist) + * and [``](https://reactnative.dev/docs/sectionlist) components, which are also better +@@ -1019,7 +1006,8 @@ class VirtualizedList extends StateSafePureComponent { + const spacerKey = this._getSpacerKey(!horizontal); + + const renderRegions = this.state.renderMask.enumerateRegions(); +- const lastSpacer = findLastWhere(renderRegions, r => r.isSpacer); ++ const lastRegion = renderRegions[renderRegions.length - 1]; ++ const lastSpacer = lastRegion?.isSpacer ? lastRegion : null; + + for (const section of renderRegions) { + if (section.isSpacer) { From 4659b5463990f8b821edeeed8bc56f9e649b540b Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 12 Dec 2023 19:33:04 +0100 Subject: [PATCH 4/7] update patch --- ...-native-web+0.19.9+005+fixLastSpacer.patch | 39 ++++++++----------- 1 file changed, 16 insertions(+), 23 deletions(-) diff --git a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch index 75634006f35c..1a4b49369524 100644 --- a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch +++ b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch @@ -1,34 +1,27 @@ -diff --git a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js -index f303b31..748173d 100644 ---- a/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js -+++ b/node_modules/react-native-web/src/vendor/react-native/VirtualizedList/index.js -@@ -126,19 +126,6 @@ function windowSizeOrDefault(windowSize: ?number) { - return windowSize ?? 21; +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 faeb323..8b6f618 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 +@@ -78,14 +78,6 @@ function scrollEventThrottleOrDefault(scrollEventThrottle) { + function windowSizeOrDefault(windowSize) { + return windowSize !== null && windowSize !== void 0 ? windowSize : 21; } - --function findLastWhere( -- arr: $ReadOnlyArray, -- predicate: (element: T) => boolean, --): T | null { -- for (let i = arr.length - 1; i >= 0; i--) { +-function findLastWhere(arr, predicate) { +- for (var i = arr.length - 1; i >= 0; i--) { - if (predicate(arr[i])) { - return arr[i]; - } - } -- - return null; -} -- - /** - * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist) - * and [``](https://reactnative.dev/docs/sectionlist) components, which are also better -@@ -1089,7 +1076,8 @@ class VirtualizedList extends StateSafePureComponent { - const spacerKey = this._getSpacerKey(!horizontal); - const renderRegions = this.state.renderMask.enumerateRegions(); -- const lastSpacer = findLastWhere(renderRegions, r => r.isSpacer); +@@ -1119,7 +1050,8 @@ class VirtualizedList extends StateSafePureComponent { + _keylessItemComponentName = ''; + var spacerKey = this._getSpacerKey(!horizontal); + var renderRegions = this.state.renderMask.enumerateRegions(); +- var lastSpacer = findLastWhere(renderRegions, r => r.isSpacer); + const lastRegion = renderRegions[renderRegions.length - 1]; + const lastSpacer = lastRegion?.isSpacer ? lastRegion : null; - - for (const section of renderRegions) { + for (var _iterator = _createForOfIteratorHelperLoose(renderRegions), _step; !(_step = _iterator()).done;) { + var section = _step.value; if (section.isSpacer) { From f4592cbdb70a8f7c565287e1f70399a163fc40d3 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Fri, 15 Dec 2023 15:17:13 +0100 Subject: [PATCH 5/7] fix patch --- patches/react-native-web+0.19.9+005+fixLastSpacer.patch | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch index 1a4b49369524..d56d22094e87 100644 --- a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch +++ b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch @@ -1,5 +1,5 @@ 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 faeb323..8b6f618 100644 +index faeb323..68d740a 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 @@ -78,14 +78,6 @@ function scrollEventThrottleOrDefault(scrollEventThrottle) { @@ -15,7 +15,9 @@ index faeb323..8b6f618 100644 - return null; -} -@@ -1119,7 +1050,8 @@ class VirtualizedList extends StateSafePureComponent { + /** + * Base implementation for the more convenient [``](https://reactnative.dev/docs/flatlist) +@@ -1119,7 +1111,8 @@ class VirtualizedList extends StateSafePureComponent { _keylessItemComponentName = ''; var spacerKey = this._getSpacerKey(!horizontal); var renderRegions = this.state.renderMask.enumerateRegions(); From 13dd61c3d1f7a8a8dd9c1d33c7cdf006c8c80c99 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Thu, 21 Dec 2023 19:42:56 +0100 Subject: [PATCH 6/7] const replace with var --- patches/react-native-web+0.19.9+005+fixLastSpacer.patch | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch index d56d22094e87..fc48c00094dc 100644 --- a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch +++ b/patches/react-native-web+0.19.9+005+fixLastSpacer.patch @@ -22,8 +22,8 @@ index faeb323..68d740a 100644 var spacerKey = this._getSpacerKey(!horizontal); var renderRegions = this.state.renderMask.enumerateRegions(); - var lastSpacer = findLastWhere(renderRegions, r => r.isSpacer); -+ const lastRegion = renderRegions[renderRegions.length - 1]; -+ const lastSpacer = lastRegion?.isSpacer ? lastRegion : null; ++ var lastRegion = renderRegions[renderRegions.length - 1]; ++ var lastSpacer = lastRegion?.isSpacer ? lastRegion : null; for (var _iterator = _createForOfIteratorHelperLoose(renderRegions), _step; !(_step = _iterator()).done;) { var section = _step.value; if (section.isSpacer) { From 8aca887be7a8d12173df2bc7b5b1506184e8a984 Mon Sep 17 00:00:00 2001 From: Taras Perun Date: Tue, 9 Jan 2024 11:37:49 +0100 Subject: [PATCH 7/7] reapply patch after merge --- ...acer.patch => react-native-web+0.19.9+004+fixLastSpacer.patch} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename patches/{react-native-web+0.19.9+005+fixLastSpacer.patch => react-native-web+0.19.9+004+fixLastSpacer.patch} (100%) diff --git a/patches/react-native-web+0.19.9+005+fixLastSpacer.patch b/patches/react-native-web+0.19.9+004+fixLastSpacer.patch similarity index 100% rename from patches/react-native-web+0.19.9+005+fixLastSpacer.patch rename to patches/react-native-web+0.19.9+004+fixLastSpacer.patch