react-native得flatList如何滚动到顶部

// 通过ref属性 调用scrollToOffset方法
let flat = ''
 < FlatList
        ref={(flatList) => { flat = flatList }}
         data={this.props.lockRoom.prizeList}
          renderItem={({ item }) => this.renderItem(item)}
         keyExtractor={(item) => item.orderId}
          ListFooterComponent={this.renderFooter}
          refreshing={this.state.refreshing}
          onRefresh={this.onRefresh}
         onEndReached={this.onEndReached}
                />
    flat.scrollToOffset({ offset: 0 }) // 滚动到顶部

你可能感兴趣的:(react-native)