title: React native flatlist horizontall autoscroll
body: <p>How to stop autoscroll after touching the flatlist? Now it scrolls always and can`t be stop.
  Or how to continue autoscroll from the index where i stopped touching scroll</p>
  <pre><code> const ref = useRef();
    let currentSlide = 0;
    let intervalTime = 4000;
  
    const goToNextPage = () =&gt; {
      if (currentSlide &gt;= banners.length - 1) currentSlide = -1;
      ref.current.scrollToIndex({
        index: ++currentSlide,
        animated: true,
      });
    };
  
     useEffect(() =&gt; {
      setInterval(goToNextPage, intervalTime);
    }, []);
  
  
  return(
   &lt;FlatList
            data={banners}
            keyExtractor={item =&gt; item.id}
            renderItem={renderItem}
            scrollEventThrottle={16}
            contentContainerStyle={{paddingHorizontal: 12}}
            showsHorizontalScrollIndicator={false}
            horizontal
            snapToInterval={bannersWidth + 24}
            decelerationRate={'fast'}
            bounces={false}
            ref={ref}
            getItemLayout={(data, index) =&gt; ({
              length: bannersWidth + 24,
              offset: (bannersWidth + 24) * index,
              index,
            })}
          /&gt;
  )
  </code></pre>