title: Call child method in main class in react-native
body: <p>I have a child class to render an Alert with some variables.
  I make myAlert.js file and import it in the main.js</p>
  
  <p>here are my codes:</p>
  
  <pre><code>// main.js
  
  
  onLoginPressed() {
  // Call showAlert from child
  }
  
  render() {
    return (
      &lt;View&gt;
        &lt;TouchableHighlight
           onPress = {this.onLoginPressed.bind(this)}
         /&gt;
      &lt;/View&gt;
    )
  }
  </code></pre>
  
  <p>and now myAlert.js:</p>
  
  <pre><code>// myAlert.js
  
  
  export default class myAlert extends React.Component {
    constructor(){
    super();
    }
  
  render() {
  const {showAlert} = this.state;
  
    return (
        &lt;View&gt;
  
          &lt;AwesomeAlert
            showProgress = {false}
            title = "AwesomeAlert"
          /&gt;
  
        &lt;/View&gt;
    )
  }
  }
  </code></pre>
  
  <p>the point is, i want to send "showProgress" and "title" to the child so i can have my customized alert every time is call the child method!</p>
  
  <p>but i get errors...</p>
  
  <p><strong>1. where is my mistake?</strong></p>
  
  <p><strong>2. Should i use redux to control my states in situations like this?</strong></p>
  
  <blockquote>
    <p>thanks in advance! </p>
  </blockquote>