Skip to content

Commit

Permalink
Merge branch 'perunt/onStartReached-fix' of https://github.com/margel…
Browse files Browse the repository at this point in the history
  • Loading branch information
perunt committed Feb 7, 2024
2 parents ce1354e + 0376519 commit ddb682c
Showing 1 changed file with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
diff --git a/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js b/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js
index 0516679..e338d90 100644
--- a/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js
+++ b/node_modules/@react-native/virtualized-lists/Lists/VirtualizedList.js
@@ -1546,7 +1546,7 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {
// Next check if the user just scrolled within the start threshold
// and call onStartReached only once for a given content length,
// and only if onEndReached is not being executed
- else if (
+ if (
onStartReached != null &&
this.state.cellsAroundViewport.first === 0 &&
isWithinStartThreshold &&
@@ -1558,13 +1558,11 @@ class VirtualizedList extends StateSafePureComponent<Props, State> {

// If the user scrolls away from the start or end and back again,
// cause onStartReached or onEndReached to be triggered again
- else {
- this._sentStartForContentLength = isWithinStartThreshold
- ? this._sentStartForContentLength
- : 0;
- this._sentEndForContentLength = isWithinEndThreshold
- ? this._sentEndForContentLength
- : 0;
+ if (!isWithinStartThreshold) {
+ this._sentStartForContentLength = 0;
+ }
+ if (!isWithinEndThreshold) {
+ this._sentEndForContentLength = 0;
}
}

0 comments on commit ddb682c

Please sign in to comment.