title: How to access child component values from the parent in react native?
body: <p>I have a login screen with following structure:</p>
  
  <pre><code>import Logo from '../components/Logo'
  import Form from '../components/Form';
  
  export default class Login extends React. Component {
    &lt;View style={styles.container} &gt;
      &lt;Logo/&gt;
      &lt;Form type="login"/&gt;
      &lt;View style={styles.signUpTextCont}&gt;
        ...
      &lt;/View&gt;
    &lt;/View&gt;
  </code></pre>
  
  <p>and here is my Form component: </p>
  
  <pre><code>export default class Form extends React.Component {
  constructor (props){
   super(props)
    this.state = {
    username : '',
    password : ''
   } 
  }
  handleChangeUsername = (text) =&gt; {
   this.setState({ username: text })
  }
  handleChangePassword = (text) =&gt; {
  this.setState({ password: text })
  }
  render() {
   return (
    &lt;View style={styles.container} &gt;
    &lt;TextInput
      ref={(input) =&gt; { this.username = input }}
      onChangeText = {this.handleChangeUsername}
      value = {this.state.username} 
      /&gt;
  
    &lt;TextInput 
      ref={(input) =&gt; { this.password = input }}
      onChangeText = {this.handleChangePassword}
      value = {this.state.password}
      /&gt;
       &lt;TouchableOpacity style={styles.button}&gt;
           &lt;Text style={styles.buttonText}&gt;{this.props.type}&lt;/Text&gt;
  
      &lt;/TouchableOpacity&gt;
    &lt;/View&gt;
    );
    }
   }
  </code></pre>
  
  <p>now I would like to have a checkLogin() method in Login screen (parent).
  How can I access username and password values to check them in the Login screen?</p>
  
  <p>I will be grateful if someone could help.</p>