title: How do I access refs of a parent component in the child
body: <p>I have a parent and a child, I have to make sure that the child component that is contained within the father can refer to him.</p>
  
  <p>For example, on the child button I want to call the openDrawer() method, which is used in the parent.</p>
  
  <p>I tried to pass the parent's reference to the child through a props, but it does not work.</p>
  
  <p>Where am I doing wrong?</p>
  
  <p>How can I do?</p>
  
  <p>Parent:</p>
  
  <pre><code>import * as React from 'react';
  import { StyleSheet, View, Text, ToastAndroid, Button, Toolbar } from 'react-native';
  import NavigationDrawerLayout from 'react-native-navigation-drawer-layout';
  
  import Homepage from './page/Homepage';
  import PageOne from './page/pageOne';
  import PageTwo from './page/pageTwo';
  
  export default class App extends React.Component {
    constructor() {
      super();
      this.state = {
        menu: '',
        type: '',
        drawer: ''
      };
    }
  
    render() {
      return (
        &lt;NavigationDrawerLayout
          ref={_drawer =&gt; (this.drawer = _drawer)}
          //ref={(_drawer) =&gt; this.setState({drawer:_drawer})}
          percent={75}
          //statusBar="#008cff"
          //statusBarTransparency={0.3}
          type={this.state.type}
          drawerPosition="left"
          selected="opt3"
          window="menu"
          color="#fff"
          backgroundColor="#303030" //303030
          imageBackground="https://c.wallhere.com/photos/aa/44/glare_colorful_bright_circles-679384.jpg!d"
          first={'username'}
          second={'joined'}
          account={[
            {
              username: 'james.bond',
              name: 'James Bond',
              email: 'james.bond.xx@xxx.xxx',
              image:
                'https://cdn1.iconfinder.com/data/icons/avatar-2-2/512/Casual_Man_2-512.png',
              joined: 'Joined at Jun 21, 2021',
              badgeText: '100',
              badgeColor: '#fff',
              badgeBackground: '#303030',
              circle: ['transparent', 'transparent'],
            },
            {
              username: 'sherlock.holmes',
              name: 'Sherlock Holmes',
              email: 'sherlock.holmes.xx@xxx.xxx',
              badgeText: '100',
              badgeColor: '#fff',
              badgeBackground: '#303030',
              circle: ['#fff000', 'transparent', '#00ffd0'],
            },
            {
              name: 'Shinichi Kudo',
              email: 'shinichi.kudo.xx@xxx.xxx',
              image:
                'https://cdn1.iconfinder.com/data/icons/avatar-2-2/512/Casual_Man_3-512.png',
              badgeText: '21',
              badgeColor: '#fff',
              badgeBackground: '#25dbd2',
              joined: 'Joined at Jun 31, 2021',
              circle: ['transparent', 'transparent'],
            },
            {
              name: 'Arthur Conan Doyle',
              email: 'arthur.conan.doyle.xx@xxx.xxx',
              image:
                'https://cdn0.iconfinder.com/data/icons/user-interface-vol-3-12/66/68-512.png',
              circle: ['transparent', 'transparent'],
            },
          ]}
          badgeFunction={e =&gt; {
            return e &gt; 99 ? '99+' : e;
          }}
          menu={[
            {
              type: 'menu',
              name: 'opt0',
              backgroundLarge: 'transparent',
              backgroundLargeFocus: 'transparent',
              backgroundSmall: 'rgba(13, 71, 161, 0.5)',
              backgroundSmallFocus: 'rgba(213, 0, 0, 0.5)',
              iconLeft: 'apps',
              iconLeftColor: '#c1c1c1',
              iconLeftColorFocus: '#4CAF50',
              title: 'Le mie app e i miei giochi',
              titleColor: '#000000',
              titleColorFocus: '#4CAF50',
              badgeText: '100',
              badgeColor: '#ffffff',
              badgeBackground: '#1194ff',
              iconRight: 'exit-to-app',
              iconRightColor: '#4CAF50',
              iconRightColorFocus: '#EF6C00',
              close: false,
            },
            {
              type: 'menu',
              name: 'opt3',
              title: 'Abbonamenti',
              backgroundLarge: '#4286f4',
              backgroundLargeFocus: '#34ed6b',
              backgroundSmallFocus: 'rgba(213, 0, 0, 0.5)',
              iconLeft: 'apps',
              iconLeftColor: '#c1c1c1',
              iconLeftColorFocus: '#4CAF50',
              badgeText: '100',
              badgeColor: '#ffffff',
              badgeBackground: '#1194ff',
              iconRight: 'exit-to-app',
              iconRightColor: '#4CAF50',
              iconRightColorFocus: '#EF6C00',
            },
          ]}
          onPress={e =&gt; {
            ToastAndroid.show("Title: "+e.title+" * "+"Name: "+e.name,ToastAndroid.SHORT);
            console.log('Menu:', e);
            var type = e.name == 'opt2' ? 'simple' : '';
            this.setState({ menu: e.title, type });
          }}&gt;
          &lt;Homepage drawer={this.drawer} /&gt;
        &lt;/NavigationDrawerLayout&gt;
      );
    }
  }
  
  const styles = StyleSheet.create({});
  </code></pre>
  
  <p>Child:</p>
  
  <pre><code>import * as React from 'react';
  import { Text, View, Button } from 'react-native';
  
  export default class Homepage extends React.Component {
    render() {
      const {drawer} = this.props;
      return (
        &lt;View
          style={{
            flex: 1,
            //alignItems: 'flex-end',
          }}&gt;
          &lt;Text style={{ marginTop: 25, marginRight: 5, textAlign: 'right' }}&gt;Hello World!&lt;/Text&gt;
          &lt;Text style={{ marginTop: 25, marginRight: 5, textAlign: 'right' }}&gt;
            State: !
          &lt;/Text&gt;
          &lt;Button
            onPress={()=drawer.openDrawer()}
            title="Open"
            color="#4286f4"
          /&gt;
        &lt;/View&gt;
      );
    }
  }
  </code></pre>