Skip to content

Instantly share code, notes, and snippets.

@sueLan
Created March 5, 2020 13:33
Show Gist options
  • Save sueLan/aa6ac8954143490e719790f0313bb8eb to your computer and use it in GitHub Desktop.
Save sueLan/aa6ac8954143490e719790f0313bb8eb to your computer and use it in GitHub Desktop.
viewabilityConfig = {
waitForInteraction: true,
viewAreaCoveragePercentThreshold: 95,
itemVisiblePercentThreshold: 75
}
onViewableItemsChanged = ({viewableItems, changed}) => {
console.log("Visible items are", viewableItems);
console.log("Changed in this iteration", changed);
};
render() {
return (
<FlatList
style={{
paddingTop: 60
}}
viewabilityConfig={this.viewabilityConfig}
onViewableItemsChanged={this.onViewableItemsChanged}
data={this._items}
renderItem={this._renderItem}
keyExtractor={item => item.id}
/>
)
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment