Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/react-native/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
React native reactnative-flatlist-使用滚动条滚动_React Native_React Native Flatlist - Fatal编程技术网

React native reactnative-flatlist-使用滚动条滚动

React native reactnative-flatlist-使用滚动条滚动,react-native,react-native-flatlist,React Native,React Native Flatlist,我使用react-native(react 16.2.0,react-native 0.54) 我用flatlist显示一个大的项目列表。我们可以举一个有1000名员工的联系人名单为例 flatlist运行良好,没有bug,但我不能像在原生Android或html页面中那样按滚动条的光标导航 复制步骤 <FlatList ref="listRef" data={this.state.data} keyExtractor={(item, index) => item.na

我使用react-native(react 16.2.0,react-native 0.54)

我用flatlist显示一个大的项目列表。我们可以举一个有1000名员工的联系人名单为例

flatlist运行良好,没有bug,但我不能像在原生Android或html页面中那样按滚动条的光标导航

复制步骤

 <FlatList
  ref="listRef"
  data={this.state.data}
  keyExtractor={(item, index) => item.name.toString()}
  removeClippedSubviews={true}
  extraData={{ refreshListIteration: this.state.refreshListIteration }}
  renderItem={({ item, index }) => this.renderListItem(item, index)}
  initialNumToRender={15}
  ItemSeparatorComponent={this.renderSeparator}
  ListHeaderComponent={this.renderOptionBar}
  ListFooterComponent={this.renderFooter}
  onEndThreshold={5}
/>
item.name.toString()}
RemoveClippedSubview={true}
extraData={{refreshListIteration:this.state.refreshListIteration}
renderItem={({item,index})=>this.renderListItem(item,index)}
initialNumToRender={15}
ItemSeparatorComponent={this.renderSeparator}
ListHeaderComponent={this.renderOptionBar}
ListFooterComponent={this.renderFooter}
onEndThreshold={5}
/>
预期行为

因此,我需要在
this.state.data
中显示1000项

我一开始会显示15个项目(
initialNumToRender={15}
),以获得更快的性能,因此如果我想看到第600个项目,我需要向下滚动40次,这对用户来说不是很友好。 我不能像html页面那样按滚动条的光标快速导航到列表的末尾

问题


你知道如何解决这个问题,或者在不向下滚动十几次的情况下快速导航吗?

这不是iOS上的典型行为。滚动指示器通常不可敲击

FlatList有一个名为initialScrollIndex的道具,如果您希望在特定项目上加载列表,可以使用该道具。 或者,如果你不想一开始就这么做。FlatList还有scrollToIndex和scrollToItem方法,允许您通过编程方式移动到特定的索引或项目。

谢谢您的回复。我想有一个可点击的滚动指示器,以避免滚动很多次。我无法使用scrollToIndex和scrollToItem,因为我不知道用户希望在此列表中看到什么:w