1.设置ref
<FlatList
ref={this._getRef}
data={data}
refreshing={this.state.refreshing}
onRefresh={this._freshData}
getItemLayout={(param, index) => ({ length: 64, offset: 64 * index, index })} //设置优化滚轮滑动效率 64为每个item高度
/>
_getRef = (flatList) => {
this._flatList = flatList;
const reObj = this._flatList;
return reObj;
}
2.使用方法
this._flatList.scrollToIndex({ viewPosition: 0, index: 0 });