title: I am using react-native-swiper-flatlist , but I cannot figure it out how to use scrollToIndex on button press
body: <p>I am using <em>react-native-swiper-flatlist</em> , I want to scroll forward to some index by tapping button but no clue how to do it. Although I am very beginner to react native development.</p>
  
  <p>I have searched alot but nothing helps, I get an error of undefined is not an object this2.swiper.scrollToIndex'</p>
  
  <pre><code>render() {
  return (
    &lt;View style={styles.container}&gt;
      &lt;SwiperFlatList
        ref={swiper =&gt; {
          this.swiper = swiper;
        }}
        data={[
          { key: "a" },
          { key: "b" },
          { key: "c" },
          { key: "d" },
          { key: "e" }
        ]}
        index={0}
        renderItem={({ item, index }) =&gt; (
          &lt;View&gt;
            &lt;Image
              style={styles.child}
              source={require("../../assets/advertisementtwo.png")}
            /&gt;
            &lt;Image
              style={styles.child}
              source={require("../../assets/advertisementtwo.png")}
            /&gt;
            &lt;Image
              style={styles.child}
              source={require("../../assets/advertisementtwo.png")}
            /&gt;
            &lt;Image
              style={styles.child}
              source={require("../../assets/advertisementtwo.png")}
            /&gt;
            &lt;Button
              title={"Next"}
              onPress={this.swiper.scrollToIndex(1, true)}
              style={{ backgroundColor: "white" }}
            /&gt;
          &lt;/View&gt;
        )}
      /&gt;
    &lt;/View&gt;
  );
  </code></pre>
  
  <p>}</p>
  
  <p>Should swipe on button click</p>
  
  <p><a href="https://i.stack.imgur.com/5g5Qg.png" rel="nofollow noreferrer">Here is the screenshot of the error I am getting</a></p>