Skip to content

Instantly share code, notes, and snippets.

@kelvinlemus
Created February 17, 2017 22:44
Show Gist options
  • Select an option

  • Save kelvinlemus/87d5af6330d6d4db6ae04db12844bf28 to your computer and use it in GitHub Desktop.

Select an option

Save kelvinlemus/87d5af6330d6d4db6ae04db12844bf28 to your computer and use it in GitHub Desktop.
constructor(props) {
super(props);
this.state = {
listHeight: null,
footerY: null
}
}
let scrollDistance = this.state.listHeight - this.state.footerY
this.listView.scrollTo({x: this.state.listHeight, y: this.state.footerY, animated: true})
<ListView
ref={(component)=> this.listView = component }
onLayout={(event) => {
let layout = event.nativeEvent.layout
this.setState({
listHeight : layout.height
})
}}
renderFooter={() => {
return (
<View
onLayout={(event)=>{
let layout = event.nativeEvent.layout
this.setState({
footerY : layout.y
})
}}>
</View>
)
}}
initialListSize={120}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment