@react-native-macos/virtualized-lists 0.77.5 → 0.78.5

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.
@@ -14,6 +14,8 @@ import type ListMetricsAggregator, {
14
14
  CellMetricProps,
15
15
  } from './ListMetricsAggregator';
16
16
 
17
+ import * as ReactNativeFeatureFlags from 'react-native/src/private/featureflags/ReactNativeFeatureFlags';
18
+
17
19
  /**
18
20
  * Used to find the indices of the frames that overlap the given offsets. Useful for finding the
19
21
  * items that bound different windows of content, such as the visible area or the buffered overscan
@@ -176,10 +178,20 @@ export function computeWindowedRenderLimits(
176
178
  break;
177
179
  }
178
180
  const maxNewCells = newCellCount >= maxToRenderPerBatch;
179
- const firstWillAddMore = first <= prev.first || first > prev.last;
181
+
182
+ let firstWillAddMore;
183
+ let lastWillAddMore;
184
+
185
+ if (ReactNativeFeatureFlags.fixVirtualizeListCollapseWindowSize()) {
186
+ firstWillAddMore = first <= prev.first;
187
+ lastWillAddMore = last >= prev.last;
188
+ } else {
189
+ firstWillAddMore = first <= prev.first || first > prev.last;
190
+ lastWillAddMore = last >= prev.last || last < prev.first;
191
+ }
192
+
180
193
  const firstShouldIncrement =
181
194
  first > overscanFirst && (!maxNewCells || !firstWillAddMore);
182
- const lastWillAddMore = last >= prev.last || last < prev.first;
183
195
  const lastShouldIncrement =
184
196
  last < overscanLast && (!maxNewCells || !lastWillAddMore);
185
197
  if (maxNewCells && !firstShouldIncrement && !lastShouldIncrement) {
@@ -1052,6 +1052,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
1052
1052
  <View
1053
1053
  collapsable={Platform.OS !== 'macos'} // [macOS]
1054
1054
  key={`$spacer-${section.first}`}
1055
+ // $FlowFixMe[incompatible-type]
1055
1056
  style={{[spacerKey]: spacerSize}}
1056
1057
  />,
1057
1058
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-macos/virtualized-lists",
3
- "version": "0.77.5",
3
+ "version": "0.78.5",
4
4
  "description": "Virtualized lists for React Native macOS.",
5
5
  "license": "MIT",
6
6
  "repository": {
@@ -24,10 +24,10 @@
24
24
  "nullthrows": "^1.1.1"
25
25
  },
26
26
  "devDependencies": {
27
- "react-test-renderer": "18.3.1"
27
+ "react-test-renderer": "19.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@types/react": "^18.2.6",
30
+ "@types/react": "^19.0.0",
31
31
  "react": "*",
32
32
  "react-native": "*"
33
33
  },