Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix] Fixing overscrolling issue on Virtualized List #23181

Closed
wants to merge 1 commit into from

Conversation

dusave
Copy link

@dusave dusave commented Jan 28, 2019

Changelog:

[iOS][fixed] Fixed overscroll behavior on iOS virtualized lists (Fixes #18098)

Test Plan:

  • Create a section list (for iOS)
  • Attempt to scroll to an item towards the bottom

Expected: List scrolls to the item to the correct position without overscrolling the list
Actual: List is over scrolling to put the item in the proper position. This causes future scrolling to jump.

Code Used to Test:

this.listRef.scrollToLocation({ animated: true, sectionIndex: 11, itemIndex: 0, viewPosition: 0});

...

<SectionList
  ref={ (ref) => this.listRef = ref }
  renderItem={({item, index, section}) => (
    <Text key={index} style={{flex: 1, padding: 4}}>{item}</Text>
  )}
  renderSectionHeader={({section: {title}}) => (
    <Text style={{flex: 1, padding: 4}}>{title}</Text>
  )}
   sections={[
    {title: 'A', data: ['item1', 'item2']},
    {title: 'B', data: ['item3', 'item4']},
    {title: 'C', data: ['item5', 'item6']},
    {title: 'D', data: ['item1', 'item2']},
    {title: 'E', data: ['item3', 'item4']},
    {title: 'F', data: ['item5', 'item6']},
    {title: 'G', data: ['item1', 'item2']},
    {title: 'H', data: ['item3', 'item4']},
    {title: 'I', data: ['item5', 'item6']},
    {title: 'J', data: ['item1', 'item2']},
    {title: 'K', data: ['item3', 'item4']},
    {title: 'L', data: ['item5', 'item6']},
]}/>

Before:
before

After:
after

@facebook-github-bot facebook-github-bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Jan 28, 2019
@pull-bot
Copy link

Warnings
⚠️

📋 Changelog - This PR may have incorrectly formatted Changelog. Please format it as explained in the contributing guidelines.

Generated by 🚫 dangerJS

Copy link
Contributor

@cpojer cpojer left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for sending a PR :)

@facebook-github-bot facebook-github-bot added the Import Started This pull request has been imported. This does not imply the PR has been approved. label Jan 28, 2019
Copy link
Contributor

@facebook-github-bot facebook-github-bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cpojer is landing this pull request. If you are a Facebook employee, you can view this diff on Phabricator.

@react-native-bot
Copy link
Collaborator

Dustin Savery merged commit 4d5f85e into facebook:master.

@facebook facebook locked as resolved and limited conversation to collaborators Jan 28, 2019
@react-native-bot react-native-bot added the Merged This PR has been merged. label Jan 28, 2019
@cpojer
Copy link
Contributor

cpojer commented Jan 29, 2019

It was pointed out to me that this was not the correct fix for this issue. You should be able to use overScrollMode="never" to fix this problem instead.

@hramos hramos removed Import Started This pull request has been imported. This does not imply the PR has been approved. labels Feb 6, 2019
matt-oakes pushed a commit to matt-oakes/react-native that referenced this pull request Feb 7, 2019
Summary:
Changelog:
----------
[iOS][fixed] Fixed overscroll behavior on iOS virtualized lists (Fixes facebook#18098)
Pull Request resolved: facebook#23181

Differential Revision: D13838579

Pulled By: cpojer

fbshipit-source-id: 2ec5787218ecca0e01aaf31bfbb7d630cf9f1f09
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. Merged This PR has been merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[SectionList] scrollToLocation scrolls past content on iOS
6 participants