From 5e60a5e04da77a6cbc5140e6620050689cfd8302 Mon Sep 17 00:00:00 2001 From: or-else Date: Mon, 23 Jan 2023 10:00:07 -0800 Subject: [PATCH] call parent on lost focuse --- src/widgets/phone-edit.jsx | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/widgets/phone-edit.jsx b/src/widgets/phone-edit.jsx index 9240205c..7c688ec8 100644 --- a/src/widgets/phone-edit.jsx +++ b/src/widgets/phone-edit.jsx @@ -29,8 +29,10 @@ class PhoneEdit extends React.PureComponent { } handleFinished(e) { + // this.setCustomValidity("Mobile phone number required"); e.preventDefault(); - this.props.onSubmit(this.state.localNumber.trim()); + const number = `${this.state.dialCode}${this.state.localNumber.trim()}`.replace(/[^\d]/g, '') + this.props.onSubmit(`+${number}`); } @@ -62,7 +64,8 @@ class PhoneEdit extends React.PureComponent { +{this.state.dialCode}  + maxLength={17} onKeyDown={this.handleKeyDown} onblur={this.handleFinished} + required autoFocus={this.props.autoFocus} /> ); }