title: ReactNative TextInput Focus
body: <p>I'm having a form in my application where I want the user to be able to go to the next TextInput by clicking the "Next" return button.
  My Input component:</p>
  
  <pre><code>    export default class Input extends Component {
  
    focusNextField = (nextField) =&gt; {
      console.log('NEXT FIELD:', nextField);
      this.refs[nextField].focus();
    }
  
    render() {
  
      var keyboardType = this.props.keyboardType || 'default';
      var style = [styles.textInput, this.props.style];
  
      if (this.props.hasError) style.push(styles.error);
  
      return (
        &lt;View style={styles.textInputContainer}&gt;
          &lt;TextInput
            placeholder={this.props.placeholder}
            onChangeText={this.props.onChangeText}
            style={style}
            blurOnSubmit={false}
            ref={this.props.reference}
            returnKeyType= {this.props.returnType}
            onSubmitEditing={() =&gt; this.focusNextField(this.props.fieldRef)}
            secureTextEntry={this.props.isPassword}
            value={this.props.value}
            keyboardType={keyboardType}
            underlineColorAndroid="transparent" /&gt;
          {this.props.hasError &amp;&amp; this.props.errorMessage ? &lt;Text style={{ color: 'red' }}&gt;{this.props.errorMessage}&lt;/Text&gt; : null}
        &lt;/View&gt;
      );
    }
  }
  </code></pre>
  
  <p>And how it is used:</p>
  
  <pre><code>&lt;Input onChangeText={(email) =&gt; this.setState({ email })} value={this.state.email} returnType={"next"} reference={'1'} fieldRef={'2'} keyboardType="email-address" /&gt;
  
        &lt;Text style={{ color: '#fff', marginTop: 10, }}&gt;Password&lt;/Text&gt;
        &lt;Input onChangeText={(password) =&gt; this.setState({ password })} value={this.state.password} returnType={"done"}
         reference={'2'} fieldRef={'2'} isPassword={true} /&gt;
  </code></pre>
  
  <p>But I get the error:</p>
  
  <pre><code>undefined is not an object (evaluating _this.refs[nextField].focus)
  </code></pre>