I have a flatlist showing videos. I want that when a video goes out of the view it should be paused. I am maintaining the pause state in each of the Posts component.
class Posts extends React.PureComponent {
constructor() {
super()
this.state = {
pause: true,
}
return(){
<Video
pause={this.state.pause}
//other props
/>
}
}
Run Code Online (Sandbox Code Playgroud)
I am using react-native-video.
我已经尝试使用onViewableItemsChangedof的道具,Flatlist但是它不会改变状态。
我试过了。但这似乎对我不起作用。
我应该如何进行?