React-Native:从详细信息页面导航回列表页面时,如何转到Flatlist中的特定项目

时间:2020-01-25 11:24:49

标签: react-native react-native-flatlist

以下是我的Flatlist

  <FlatList
     data={equipmentsList}
     renderItem={({ item, index }) => this.renderEquipments(item, index)}
     onScroll={(event) => this.handleScroll(event)}
  />

滚动到:

我试图通过使用ScrollTo来实现这一目标,如下所示,

  scrollTo= {{x: 0, y: this.props.list.offsets, animated: true}}

但是它不起作用。

scrollToOffset:

 this.Flatlist.scrollToOffset({
    offset: this.props.list.offsets,
    animated: true
 });

这也不起作用。

有人可以让我知道如何通过任何一种方式来使其工作吗?谢谢!

0 个答案:

没有答案