Skip to content

Instantly share code, notes, and snippets.

@alexpaul
Created June 12, 2018 09:46
Show Gist options
  • Save alexpaul/13459bc092b34e5b66aefc21dbc1b094 to your computer and use it in GitHub Desktop.
Save alexpaul/13459bc092b34e5b66aefc21dbc1b094 to your computer and use it in GitHub Desktop.
Scroll to the top of a FlatList in react-native
<FlatList...
data={}
renderItem={}
keyExtractor={}
ref={'listRef'}
/>
onAction = () => {
this.refs.listRef.scrollToOffset({x:0, y:0, animated:true})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment