@react-native/virtualized-lists 0.73.2 → 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.
- package/Lists/VirtualizedList.js +4 -15
- package/package.json +1 -1
package/Lists/VirtualizedList.js
CHANGED
|
@@ -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
|
|
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) {
|
|
@@ -1748,8 +1736,9 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
|
|
|
1748
1736
|
// If this is triggered in an `componentDidUpdate` followed by a hiPri cellToRenderUpdate
|
|
1749
1737
|
// We shouldn't do another hipri cellToRenderUpdate
|
|
1750
1738
|
if (
|
|
1739
|
+
(this._listMetrics.getAverageCellLength() > 0 ||
|
|
1740
|
+
this.props.getItemLayout != null) &&
|
|
1751
1741
|
this._shouldRenderWithPriority() &&
|
|
1752
|
-
(this._listMetrics.getAverageCellLength() || this.props.getItemLayout) &&
|
|
1753
1742
|
!this._hiPriInProgress
|
|
1754
1743
|
) {
|
|
1755
1744
|
this._hiPriInProgress = true;
|