-
Notifications
You must be signed in to change notification settings - Fork 25.1k
Closed
Labels
BugComponent: FlatListStaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.
Description
React Native version: 0.59.9
Steps To Reproduce
I console log in VirtualizedLIst. The function _maybeCallOnEndReached() called.
_maybeCallOnEndReached() {
const {
data,
getItemCount,
onEndReached,
onEndReachedThreshold,
} = this.props;
const {contentLength, visibleLength, offset} = this._scrollMetrics;
const distanceFromEnd = contentLength - visibleLength - offset;
if (
onEndReached &&
this.state.last === getItemCount(data) - 1 &&
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete this
* comment and run Flow. */
distanceFromEnd < onEndReachedThreshold * visibleLength &&
(this._hasDataChangedSinceEndReached ||
this._scrollMetrics.contentLength !== this._sentEndForContentLength)
) {
// Only call onEndReached once for a given dataset + content length.
this._hasDataChangedSinceEndReached = false;
this._sentEndForContentLength = this._scrollMetrics.contentLength;
onEndReached({distanceFromEnd});
}
}
console result: this.state.last = 0; getItemCount(data) = 2;
this.state.last !== getItemCount(data) -1 , so can not trigger onEndReached!
But for FlatList, it has reach end!
hotaryuzaki, lizhengnacl, JackClown, helsont and math-jam
Metadata
Metadata
Assignees
Labels
BugComponent: FlatListStaleThere has been a lack of activity on this issue and it may be closed soon.There has been a lack of activity on this issue and it may be closed soon.