title: react-native-router-flux Calling Actions from function
body: <p>This is my currently working login page. Everything works fine</p>
  
  <pre><code>import React, { Component } from 'react';
  import {AlertIOS , StyleSheet , View , Text} from 'react-native';
  import Button from 'react-native-button';
  import {Actions } from 'react-native-router-flux';
  
  class Login extends Component {
      render() {
          return (
             &lt;View&gt;
                 &lt;Text&gt;Hello world this is login page&lt;/Text&gt;
                 &lt;Button onPress={Actions.login2}&gt;Click &lt;/Button&gt;
             &lt;/View&gt;
          );
      }
  }
  
  export default Login;
  </code></pre>
  
  <p>However, I want to call function first for check the username and password.If it's correct I want to go to next screen. How can i achieve this. Like this code below. My real problem is I couldn't figure out calling <code>Actions.ROUTE_NAME</code> method outside of the render method.</p>
  
  <pre><code>//This is not working
  import React, { Component } from 'react';
  import {AlertIOS , StyleSheet , View , Text} from 'react-native';
  import Button from 'react-native-button';
  import {Actions } from 'react-native-router-flux';
  
  class Login extends Component {
  controlMethod(){
  if(true){Actions.login2}
  }
      render() {
          return (
             &lt;View&gt;
                 &lt;Text&gt;Hello world this is login page&lt;/Text&gt;
                 &lt;Button onPress={this.controlMethod}&gt;Click &lt;/Button&gt;
             &lt;/View&gt;
          );
      }
  }
  
  export default Login;
  </code></pre>