title: FlatList scrollToIndex using useRef with Typescript - Type Error
body: <p>I am working with FlatList and I want to create one ref to be able to scroll the FlatList when pressing one button.</p>
  <p>The thing is that I am using Typescript and I am having one type error that I am not able to solve.</p>
  <p>The question is, <strong>how do I create an interface for a FlatList ref?</strong></p>
  <p>There we have one example of what I am doing.</p>
  <pre><code>let flatListRef = useRef();
  
  &lt;FlatList
    ref={flatListRef} // Error Here
    data={store.data}
    ... /&gt;
  
  &lt;Button 
    onPress={() =&gt;
      flatListRef.current.scrollToIndex({index:index})
    } /&gt;
  </code></pre>
  <p>The type error that I am having is when I set the ref into the FlatList</p>
  <p>The error says:</p>
  <blockquote>
  <p>Overload 1 of 2, '(props: FlatListProps&lt;{ data: string; type: number;
  id: number; }&gt; | Readonly&lt;FlatListProps&lt;{ data: string; type: number;
  id: number; }&gt;&gt;): FlatList&lt;...&gt;', gave the following error.
  Type 'MutableRefObject' is not assignable to type 'LegacyRef&lt;FlatList&lt;{ data: string; type: number; id: number; }&gt;&gt; |
  undefined'.
  Type 'MutableRefObject' is not assignable to type 'RefObject&lt;FlatList&lt;{ data: string; type: number; id: number; }&gt;&gt;'.
  Types of property 'current' are incompatible.
  Type 'undefined' is not assignable to type 'FlatList&lt;{ data: string; type: number; id: number; }&gt; | null'.</p>
  <p>Overload 2 of 2, '(props: FlatListProps&lt;{ data: string; type:
  number; id: number; }&gt;, context: any): FlatList&lt;{ data: string; type:
  number; id: number; }&gt;', gave the following error.
  Type 'MutableRefObject' is not assignable to type 'LegacyRef&lt;FlatList&lt;{ data: string; type: number; id: number; }&gt;&gt; |
  undefined'.</p>
  </blockquote>
  <p>When I set the type to the ref when I create it, the error does not solve, something like:</p>
  <pre><code>interface ListProps {
    data: string;
    type: number;
    id: number;
   }
  
  let flatListRef = useRef&lt;ListProps&gt;()
  </code></pre>
  <p>Or do I need to pass the data structure or something as initialValue when I create the useRef hook?</p>