0
嗨,我想重点下一个输入字段(这是从父母扩展),而下一个(在Android键盘)被点击android键盘关闭,而不是聚焦下一个领域。如何将焦点放在下一个点击反应本机?
我尝试了一些像onSubmitEditing= this.refs.passwordFeald.focus()
它不工作的代码,我感到如果有一个人解释这也是命名组件有点糊涂更好
下面是我当前的代码
export default class InputBox extends Component {
focusNextField = (nextField) => { this.refs[nextField].focus(); };
render(){
return(
<TextInput
style = {style.input}
underlineColorAndroid='rgba(255,255,255,0.7)'
placeholderTextColor = "rgba(255,255,255,0.6)"
placeholder = {this.props.placeholder}
secureTextEntry={this.props.typePassword}
returnKeyType = {this.props.returnKeyType}
ref = {this.props.inputRef}
focusNextField = {() => this.focusNextField(this.props.onSubmitEditing)}
/>
)
}
}
export default class Login extends Component {
render(){
return(
<View style={[styles.container, commonStyle.background]}>
<View style={[headerContStyle.topContainer]}>
<MainHeading/>
</View>
<View style={[formStyle.container]}>
<InputBox
placeholder = "Email or username"
returnKeyType = "next"
inputRef = {el => this.usenameFeald = el}
onSubmitEditing= 'passwordFeald'
/>
<InputBox
placeholder = "Password"
secureTextEntery = {"true"}
returnKeyType = "go"
inputRef = {el => this.passwordFeald = el}
typePassword = {true}
/>
<CommonButton
title = "Login"
/>
<CommonButton
title = "Sign Up"
/>
<ForgotPassword />
</View>
</View>
)
}
}
ThanksNguyênHoàngit works –