Native Base Issue

next and go in Form don’t work (React Native and native-base) 😋

When using native-base’s form to handle user’s username and password. When I press next or go from keyboard, it doesn’t move cursor to the next or doesn’t submit the inputs.

I was getting error as:

“_this2.refs.password.focus is not a function” on onSubmitEditing of TextInput.

This is how I fixed it:

  • Upgraded package for native-base “^2.4.2” to native-base “^2.7.1”.
<Item floatingLabel style={{ marginLeft: 0 }}>
<Label>Mobile Number</Label>
<Input
getRef={(input) => { this.textInput = input; }}
onChangeText = {(phone) => this.setState({phone})}
value = {this.state.phone}
autoCapitalize="none"
keyboardType='numeric'
returnKeyType={"next"}
maxLength = {10}
onSubmitEditing={(event) => this._password._root.focus()}
/>
</Item>
<Item floatingLabel style={{ marginLeft: 0 }}>
<Label>Password</Label>
<Input
getRef={(c) => this._password = c}
onChangeText = {(password) => this.setState({password})}
value={this.state.password}
autoCapitalize="none"
returnKeyType={"done"}
secureTextEntry={this.state.hiddenPassword}
onSubmitEditing = {this.handleLogin}
/>
</Item>
<TouchableOpacity>
<Button style={styles.Button}
onPress={this.handleLogin.bind(this)}>
<Text style={styles.buttonText}>
LOGIN
</Text>
</Button>
</TouchableOpacity>

That’s all for this blog now. Will keep it updated once I found any more issue.