title: Can't call child component method from parent component in React Native
body: <p>I have a React Native component <code>&lt;Parent&gt;</code> that contains a component <code>&lt;Child&gt;</code>, and I want to be able to call one of Child's methods in Parent. After reading a bunch of other posts, this is what I have: </p>
  
  <p><strong>Child.js</strong></p>
  
  <pre><code>export default class Child extends Component {
    method1() {
      console.log("success");
    }
    render() {
      return(
        &lt;View/&gt;
      )
    }
  }
  </code></pre>
  
  <p><strong>Parent</strong></p>
  
  <pre><code>export default class Parent extends Component {
    render() {
      return(
        &lt;View&gt;
          &lt;TouchableOpacity
            onPress={() =&gt; this.child.method1()}
          /&gt;
          &lt;Child
            onRef={ref =&gt; (this.child = ref)}
          /&gt;
        &lt;/View&gt;
      )
    }
  }
  </code></pre>
  
  <p>I'm getting the error "_this2.child.method1 is not a function."</p>
  
  <p>Other things I've tried are using <code>refInput</code> instead of <code>onRef</code>, and doing <code>ref =&gt; {this.child = ref}</code> instead of <code>ref =&gt; (this.child = ref)</code>.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks!</p>