title: Pausing videos on FlatList horizontal when swiping
body: <p>I'm able to console log the viewable items, when swiping when using FlatList, but I was wondering how I can manage pausing the video. Or if there's a better way in doing so?</p>
  
  <p>This is the RenderItem function component</p>
  
  <pre><code>const RenderItem = (props) =&gt; {
    const [paused, setPaused] = useState(true);
  
    const togglePlay = () =&gt; setPaused(prev =&gt; !prev);
  
    return (
      &lt;View&gt;
        {props.is_video ? (
          &lt;&gt;
            &lt;Video
              paused={paused}
              repeat
              source={{uri: props.mediaUrl}}
            /&gt;
            &lt;TouchableWithoutFeedback onPress={togglePlay}&gt;
              &lt;View&gt;
                  {paused ? &lt;Icon
                  size={180}
                  name="play"
                  type="FontAwesome"
                  style={{opacity: 0.7, color: '#cccccc'}}
                /&gt; : null}
              &lt;/View&gt;
            &lt;/TouchableWithoutFeedback&gt;
          &lt;/&gt;
        ) : (
          &lt;Image source={{uri: props.mediaUrl}} /&gt;
        )}
      &lt;/View&gt;
    );
  };
  </code></pre>
  
  <p>Then in another function, I have this:</p>
  
  <pre><code>const Post = (props) =&gt; {
  
    const onViewRef = useRef((viewableItems)=&gt; {console.log(viewableItems)});
    const viewConfigRef = useRef({ viewAreaCoveragePercentThreshold: 50 });
  
    return (
      &lt;View style={{flex: 1}}&gt;
        &lt;View&gt;
          &lt;FlatList
            onViewableItemsChanged={onViewRef.current}
            viewabilityConfig={viewConfigRef.current}
            data={props.navigation.state.params.media}
            snapToAlignment={'center'}
            horizontal
            decelerationRate={'fast'}
            pagingEnabled
            renderItem={({item}) =&gt; &lt;RenderItem {...item} /&gt;}
            keyExtractor={item =&gt; item.mediaUrl}
          /&gt;
        &lt;/View&gt;
      &lt;/View&gt;
    );
  };
  </code></pre>
  
  <p>I'm able to press the video and it'll Play or Pause. When I'm swiping right now, the videos continue to play. I want to be able to ensure that when swiping, the video played will become paused now.</p>