React-native-ui-kitten: Focusing RkTextInput

Created on 9 Sep 2017  路  5Comments  路  Source: akveo/react-native-ui-kitten

Hi,

I tried to implement the code to focus on the next text input field but I cannot get it to work.

<RkTextInput style={InputStyles.inputContainer} labelStyle={InputStyles.label} inputStyle={InputStyles.text} label='Password' placeholder="minimum 8 characters" secureTextEntry={true} autoCapitalize='none' autoCorrect={false} returnKeyType='next' keyboardType='default' ref="password" onSubmitEditing={() => this.refs.confirmPassword.focus() }/>

Any idea on how I can focus on the next RkTextInput please?

Most helpful comment

Hi, you can focus it with this.refs.confirmPassword._focusInput(),

I guess we will refactor name of method in future.

All 5 comments

Hi, you can focus it with this.refs.confirmPassword._focusInput(),

I guess we will refactor name of method in future.

@SashaSkywalker Great thanks, it worked! I saw the _focusInput method being used in the component but I could not figure out how I could use it.

@SashaSkywalker How can this.refs.confirmPassword._focusInput() focus on the next RkTextInput???
I have two RkTextInput, and I put the above code inside the first RkTextInput, it didn't work!

<RkTextInput
    label={<FeatherIcon name={'user'} />}
    placeholder='Account'
    keyboardType="email-address"
    autoCapitalize="none"
    returnKeyType="next"
    onSubmitEditing={() => this.refs.confirmPassword._focusInput() }
/>
<RkTextInput
    label={<FeatherIcon name={'lock'} />}
    placeholder='Password'
    secureTextEntry={true}
/>

@SaveYourTime You need to add ref='confirmPassword' to password input:

<RkTextInput
    ref='confirmPassword'
    label={<FeatherIcon name={'lock'} />}
    placeholder='Password'
    secureTextEntry={true}
/>

Hey! be careful... the function is "the input ref".focusInput( ); not ._focusInput( ); :D

Was this page helpful?
0 / 5 - 0 ratings

Related issues

RWOverdijk picture RWOverdijk  路  3Comments

betodasilva picture betodasilva  路  3Comments

PORA69 picture PORA69  路  3Comments

chamatt picture chamatt  路  3Comments

sarmadkung picture sarmadkung  路  3Comments