php中怎么用onsubmit防止,Undefined不是TextInput onSubmitEditing Focus的对象怎么办

当用户按下键盘上的下一个按钮时,我试图聚焦下一个字段。但我一直在努力undefined is not an object (_this2.passwordInput.focus).

我有CustomInputText,这就是我实现它的方式。

labelText="Email or Phone Number"

returnKeyType = "next"

onSubmitEditing={ () => this.passwordInput.focus() }

onChangeText={text => this.setState({ username: text })}

blurOnSubmit={false}

/>

ref={(ref) => { this.passwordInput = ref; }}

labelText="Password"

secureText={true}

onChangeText={text => this.setState({ password: text })}

/>

CustomEditText.jsconst CustomEditText = props => {

return (

{props.labelText}

ref = {props.ref}

blurOnSubmit= {props.blurOnSubmit}

onSubmitEditing = {props.onSubmitEditing}

returnKeyType = {props.returnKeyType}

onFocus = {props.onFocus}

autoCapitalize="none"

editable={props.editable}

onChangeText={props.onChangeText}

keyboardType={props.keyboardType}

{...props}

value={props.value}

/>

{props.secondaryLabelText ? (

fontFamily="semi-bold"

color={props.darkText? Colors.TEXT_PRIMARY_COLOR : "#fff"}

style={styles.secondaryLabelStyle}

>

{props.secondaryLabelText}

) : null}

);

};

const styles = StyleSheet.create({

container: {

margin: 5

},

textInputStyle: {

backgroundColor: "#fff",

height: 45,

borderRadius: 5,

borderWidth: 1,

padding: 5,

marginTop: 5,

color:"#000"

},

secondaryLabelStyle: {

marginTop: 5

}

});

CustomEditText.propTypes = {

labelText: propTypes.string.isRequired,

secondaryLabelText: propTypes.string,

keyboardType: propTypes.string,

secureText: propTypes.bool,

placeholderText: propTypes.string,

placeholderTextColor: propTypes.bool,

onChangeText: propTypes.func,

darkText: propTypes.bool,

editable: propTypes.bool,

onFocus: propTypes.func,

pointerEvents: propTypes.string,

returnKeyType : propTypes.string,

onSubmitEditing: propTypes.func,

ref: propTypes.func,

blurOnSubmit: propTypes.bool

};

export default CustomEditText;

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值