onViewableItemsChanged does not seem to work when there is a state change in the app. Is this correct?
Seems like it wouldn\'t be very useful if this
You must pass in a function to onViewableItemsChanged
that is bound in the constructor of the component and you must set viewabilityConfig
as a constant outside of the Flatlist
.
Example:
class YourComponent extends Component {
constructor() {
super()
this.onViewableItemsChanged.bind(this)
}
onViewableItemsChanged({viewableItems, changed}) {
console.log('viewableItems', viewableItems)
console.log('changed', changed)
}
viewabilityConfig = {viewAreaCoveragePercentThreshold: 50}
render() {
return(
Dogs and Cats
}
/>
)
}
}