#44·ui

TextInput ref methods are broken

Author: patrick-michelbergerCreated Sep 26, 2016Updated Dec 20, 2023
Labelsbugfeature request

I try to call the focus() method on a TextInput ref. Such as

<TextInput ref="emailInput" onSubmitEditing={() => this.focusNextField('passwordInput')}/>
<TextInput ref="passwordInput"/>

// component method
focusNextField = (nextField) => {
  this.refs[nextField].focus();
};

However I get the following Error Message: _this.refs[nextField].focus is not a function

The Reference Type seems to be different compared to the React Native core and doesn't offer methods such as focus()