Skip to content

react-native SectionList can not scrollToLocation when i was scrolling #26206

Closed
@bigkrys

Description

@bigkrys

I want to implement a component similar to address book, but SectionList can jump normally when clicking on the letter on the right when there is no scroll. But when it's scrolling (and the inertia isn't over), clicking on the right letter doesn't jump
React Native version:

System:
OS: Windows 10
CPU: (20) x64 Intel(R) Xeon(R) CPU E5-2660 v2 @ 2.20GHz
Memory: 8.47 GB / 15.93 GB
Binaries:
Yarn: 1.16.0 - C:\Users\windows10\AppData\Roaming\npm\yarn.CMD
npm: 6.9.0 - C:\Program Files\nodejs\npm.CMD
react-native :0.58.6 react:16.8.3

Steps To Reproduce

<SectionList ref="sectionList" renderSectionHeader={this.renderSectionHeader} getItemLayout={this.itemLayout} sections={this.props.dataList} renderItem={this.renderItem} keyExtractor={(item, index)=> String(index)} onScrollBeginDrag={(event)=>{ this.refs.letterspace.changeActive() }} refreshing={this.props.isRefreshing} />
Clicking on the right letter triggers the following function
getIndex = (index) => { let rollIndex = index // console.log(rollIndex,'rollindex') this.refs.sectionList.scrollToLocation({animated: false, itemIndex: 0, sectionIndex: rollIndex}) }

Describe what you expected to happen:

Snack, code example, screenshot, or link to a repository:

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugComponent: SectionListStaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions