Skip to content Skip to sidebar Skip to footer

Undefined Exception While Calling Focus Method On Textinput Ref

I am trying to implement the solution proposed here for setting the focus on the next TextInput. The solution is proposed for iOS but I think it should also work for Android. Howev

Solution 1:

this.refs.Second is a FloatingLabel object which don't have a method named "focus".

You can add a focus function to FloatingLabel component like below:

focus() {
    this.refs.textInput.focus();
},

and add a ref to the TextInput in render

<Viewstyle={elementStyles}>
    {this._renderLabel()}
    <TextInputref={'textInput'}
      {...props}
    ></TextInput></View>

Post a Comment for "Undefined Exception While Calling Focus Method On Textinput Ref"