Skip to content

FlatList scroll does not work after initialScrollIndex #20421

Closed
@theasc

Description

@theasc

Environment

Environment:
OS: macOS High Sierra 10.13.6
Node: 8.10.0
Yarn: Not Found
npm: 5.6.0
Watchman: 4.9.0
Xcode: Xcode 9.4.1 Build version 9F2000
Android Studio: Not Found

Packages: (wanted => installed)
react: ^16.3.1 => 16.3.1
react-native: ^0.55.4 => 0.55.4

Description

I work on a horizontal list with the component FlatList in the tvOS environment. The problem occurs on a small list of 3 elements, I set the initialScrollIndex equal to the second or last element, the good item is selected. However when I try to go back on a previous item the selection occurs but there is no scroll.

Reproducible Demo

  <FlatList
      getItemLayout={(data, index) => ({
         length: 300,
	 offset: 300 * index,
          index,
      })}
      initialScrollIndex={this.props.initialScrollIndex}
      keyExtractor={this._keyExtractor}
      horizontal={this.props.horizontal}
      scrollEnabled={true}
      extraData={this.state}
      ref={list => (this.myScrollView = list)}
      data={this.finalData}
      removeClippedSubviews={false}
      renderItem={this.props.renderRow}
  />

Metadata

Metadata

Assignees

No one assigned

    Labels

    Ran CommandsOne of our bots successfully processed a command.Resolution: LockedThis issue was locked by the bot.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions