title: React native error on ref scrollview, but working
body: <p>I need to scroll to bottom of flatlist, so I use:</p>
  <pre class="lang-js prettyprint-override"><code>const scrollViewRef = useRef();
  
  
  //my scroll view
  &lt;ScrollView
      ref={scrollViewRef}
      onContentSizeChange={() =&gt; {
          scrollViewRef.current.scrollToEnd({ animated: true });
      }}
  
  </code></pre>
  <p>but I got these errors:</p>
  <p><a href="https://i.stack.imgur.com/oVyts.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/oVyts.png" alt="enter image description here" /></a></p>
  <p>The first one is:</p>
  <pre><code>No overload matches this call.
    Overload 1 of 2, '(props: Readonly&lt;ScrollViewProps&gt;): ScrollView', gave the following error.
      Type 'MutableRefObject&lt;undefined&gt;' is not assignable to type 'string | ((instance: ScrollView | null) =&gt; void) | RefObject&lt;ScrollView&gt; | null | undefined'.
        Type 'MutableRefObject&lt;undefined&gt;' is not assignable to type 'RefObject&lt;ScrollView&gt;'.
          Types of property 'current' are incompatible.
            Type 'undefined' is not assignable to type 'ScrollView | null'.
    Overload 2 of 2, '(props: ScrollViewProps, context?: any): ScrollView', gave the following error.
      Type 'MutableRefObject&lt;undefined&gt;' is not assignable to type 'string | ((instance: ScrollView | null) =&gt; void) | RefObject&lt;ScrollView&gt; | null | undefined'.
        Type 'MutableRefObject&lt;undefined&gt;' is not assignable to type 'RefObject&lt;ScrollView&gt;'.ts(2769)
  index.d.ts(143, 9): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes &amp; IntrinsicClassAttributes&lt;ScrollView&gt; &amp; Readonly&lt;ScrollViewProps&gt; &amp; Readonly&lt;...&gt;'
  index.d.ts(143, 9): The expected type comes from property 'ref' which is declared here on type 'IntrinsicAttributes &amp; IntrinsicClassAttributes&lt;ScrollView&gt; &amp; Readonly&lt;ScrollViewProps&gt; &amp; Readonly&lt;...&gt;'
  </code></pre>
  <p>the second one is:</p>
  <pre><code>Object is possibly 'undefined'.
  </code></pre>
  <p>Any suggestions?</p>