mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-05-30 01:37:01 +08:00
Fixing overscrolling issue on Virtualized List (#23181)
Summary: Changelog: ---------- [iOS][fixed] Fixed overscroll behavior on iOS virtualized lists (Fixes #18098) Pull Request resolved: https://github.com/facebook/react-native/pull/23181 Differential Revision: D13838579 Pulled By: cpojer fbshipit-source-id: 2ec5787218ecca0e01aaf31bfbb7d630cf9f1f09
This commit is contained in:
committed by
Facebook Github Bot
parent
8508da425e
commit
4d5f85ed42
@@ -330,13 +330,20 @@ class VirtualizedList extends React.PureComponent<Props, State> {
|
||||
return;
|
||||
}
|
||||
const frame = this._getFrameMetricsApprox(index);
|
||||
const offset =
|
||||
const maxScroll =
|
||||
this._scrollMetrics.contentLength - this._scrollMetrics.visibleLength;
|
||||
let offset =
|
||||
Math.max(
|
||||
0,
|
||||
frame.offset -
|
||||
(viewPosition || 0) *
|
||||
(this._scrollMetrics.visibleLength - frame.length),
|
||||
) - (viewOffset || 0);
|
||||
|
||||
/* Fix for overscrolling */
|
||||
if (offset > maxScroll) {
|
||||
offset = maxScroll;
|
||||
}
|
||||
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
|
||||
* suppresses an error when upgrading Flow's support for React. To see the
|
||||
* error delete this comment and run Flow. */
|
||||
|
||||
Reference in New Issue
Block a user