const component = () => {
const onViewableItemsChanged = useRef(() => {
})
return (
<FlatList
onViewableItemsChanged={onViewableItemsChanged.current}
viewabilityConfig={{
itemVisiblePercentThreshold: 100
}}
/>
)
}
class Test extends React.Component {
onViewableItemsChanged = ({ viewableItems, changed }) => {
console.log("Visible items are", viewableItems);
console.log("Changed in this iteration", changed);
}
render () => {
return (
<FlatList
onViewableItemsChanged={this.onViewableItemsChanged }
viewabilityConfig={{
itemVisiblePercentThreshold: 50
}}
/>
)
}
}