title: Change Flatlist Scroll Index while coming back to 1st Screen from 2nd Screen
body: <p>I am working on a broadcasting app, rendering the messages using the flatlist. I want to return from the bookmark screen to the flatlist screen, and scroll to the bookmarked index which I am getting from the bookmark scene. But the scroll is happening after few seconds of returning to the screen. I tried using redux but that doesn't help as well.</p>
  <p>The below function is triggered on clicking on a bookmark item to find the index of the bookmarked message from the original list.</p>
  <pre><code>searchIndex = async (id) =&gt; {
      let val = this.state.messages.findIndex(x=&gt;x._id === id)
      console.log(val)
       this.props.navigation.navigate({
         name:'BroadCastScreenTwo',
         params: {jumpValue:val},
         merge:true
       })
    }
  </code></pre>
  <p>The below function is called for changing the scroll index.</p>
  <pre><code>async componentDidMount(){
    const unsubscribe = this.props.navigation.addListener('focus', async () =&gt; {
       var val= this.props.route.params.jumpValue;
    if(val !== null){
        await this.flatListRef.scrollToIndex({
          animated: true,
          index: val,
        });
      }
      });
      unsubscribe;
  }
  </code></pre>