title: How to call a parent function from a child - react-native
body: <p>I'm struggling to find a solution to my problem , but i cannot find it anywhere . So my question is how to call a parent function from a child . The function has to be passed in a <strong>onPress={()}</strong> inside the child</p>
  
  <p><strong>Parent.js</strong></p>
  
  <pre><code>   constructor(props) {
      super(props);
      this.state = { loading: true };
      this.state = { active: 'active' };
      this.openDrawer = this.openDrawerButtonFunction.bind(this);
      this.callParent = this.callParent.bind(this)
  
         }
  
       callParent = () =&gt; {
       console.log('I am your father')   }
  </code></pre>
  
  <p><strong>Child.js</strong></p>
  
  <pre><code>     &lt;Avatar
        avatarStyle={{ height: 50 }}
        onPress={() =&gt; { this.onPressAvatar() }}
        source={require('../../assets/images/dav-r.jpeg')} /&gt;
  
        onPressAvatar = () =&gt; {
        console.log('press on avatar');
          this.props.callParent.bind(this)
  </code></pre>
  
  <p>}</p>