@react-native/virtualized-lists 0.73.3 → 0.73.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -91,19 +91,6 @@ type State = {
91
91
  pendingScrollUpdateCount: number,
92
92
  };
93
93
 
94
- function findLastWhere<T>(
95
- arr: $ReadOnlyArray<T>,
96
- predicate: (element: T) => boolean,
97
- ): T | null {
98
- for (let i = arr.length - 1; i >= 0; i--) {
99
- if (predicate(arr[i])) {
100
- return arr[i];
101
- }
102
- }
103
-
104
- return null;
105
- }
106
-
107
94
  function getScrollingThreshold(threshold: number, visibleLength: number) {
108
95
  return (threshold * visibleLength) / 2;
109
96
  }
@@ -986,7 +973,8 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
986
973
  const spacerKey = this._getSpacerKey(!horizontal);
987
974
 
988
975
  const renderRegions = this.state.renderMask.enumerateRegions();
989
- const lastSpacer = findLastWhere(renderRegions, r => r.isSpacer);
976
+ const lastRegion = renderRegions[renderRegions.length - 1];
977
+ const lastSpacer = lastRegion?.isSpacer ? lastRegion : null;
990
978
 
991
979
  for (const section of renderRegions) {
992
980
  if (section.isSpacer) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native/virtualized-lists",
3
- "version": "0.73.3",
3
+ "version": "0.73.4",
4
4
  "description": "Virtualized lists for React Native.",
5
5
  "license": "MIT",
6
6
  "repository": {