Flatlist change renderItem

821 views Asked by At

Hey so lets say I got aFlatList and want to change its renderItem how would I do it?

<FlatList
  data={this.data}
  renderItem={{item}} => <Video id={item.id}>}
  onViewableItemsChanged={(changed)=> console.log(changed)}
/>

On the piece of code above how could I change the <Video /> to include a paused property once onViewableItemsChanged is triggered ?

Thanks in advance

1

There are 1 answers

1
Meysam Izadmehr On

You can add setState in the onViewableItemsChanged to store the changes then use that in the renderItem to pause the video.