Skip to content

Commit 4d5f85e

Browse files
Dustin Saveryfacebook-github-bot
Dustin Savery
authored andcommittedJan 28, 2019
Fixing overscrolling issue on Virtualized List (#23181)
Summary: Changelog: ---------- [iOS][fixed] Fixed overscroll behavior on iOS virtualized lists (Fixes #18098) Pull Request resolved: #23181 Differential Revision: D13838579 Pulled By: cpojer fbshipit-source-id: 2ec5787218ecca0e01aaf31bfbb7d630cf9f1f09
1 parent 8508da4 commit 4d5f85e

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed
 

‎Libraries/Lists/VirtualizedList.js

+8-1
Original file line numberDiff line numberDiff line change
@@ -330,13 +330,20 @@ class VirtualizedList extends React.PureComponent<Props, State> {
330330
return;
331331
}
332332
const frame = this._getFrameMetricsApprox(index);
333-
const offset =
333+
const maxScroll =
334+
this._scrollMetrics.contentLength - this._scrollMetrics.visibleLength;
335+
let offset =
334336
Math.max(
335337
0,
336338
frame.offset -
337339
(viewPosition || 0) *
338340
(this._scrollMetrics.visibleLength - frame.length),
339341
) - (viewOffset || 0);
342+
343+
/* Fix for overscrolling */
344+
if (offset > maxScroll) {
345+
offset = maxScroll;
346+
}
340347
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
341348
* suppresses an error when upgrading Flow's support for React. To see the
342349
* error delete this comment and run Flow. */

0 commit comments

Comments
 (0)