provide default value for the field
This commit is contained in:
@@ -8,7 +8,7 @@ export default class VisiblePassword extends React.PureComponent {
|
||||
this.inputRef = React.createRef();
|
||||
|
||||
this.state = {
|
||||
value: this.props.value,
|
||||
value: this.props.value || '',
|
||||
visible: false
|
||||
};
|
||||
|
||||
@@ -39,7 +39,7 @@ export default class VisiblePassword extends React.PureComponent {
|
||||
handleKeyDown(e) {
|
||||
if (e.keyCode == 27) {
|
||||
// Escape pressed
|
||||
this.setState({value: this.props.value, visible: false});
|
||||
this.setState({value: this.props.value || '', visible: false});
|
||||
if (this.props.onFinished) {
|
||||
this.props.onFinished();
|
||||
}
|
||||
@@ -68,7 +68,7 @@ export default class VisiblePassword extends React.PureComponent {
|
||||
return (
|
||||
<div tabIndex="-1" className="group-focus" onBlur={this.handleEditingFinished}>
|
||||
<input className="with-visibility"
|
||||
type={this.state.visible ? "text" : "password"}
|
||||
type={this.state.visible ? 'text' : 'password'}
|
||||
value={this.state.value}
|
||||
placeholder={this.props.placeholder}
|
||||
required={this.props.required ? 'required' : ''}
|
||||
|
||||
+3
-3
@@ -16313,7 +16313,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
||||
super(props);
|
||||
this.inputRef = react__WEBPACK_IMPORTED_MODULE_0___default().createRef();
|
||||
this.state = {
|
||||
value: this.props.value,
|
||||
value: this.props.value || '',
|
||||
visible: false
|
||||
};
|
||||
this.handleVisibility = this.handleVisibility.bind(this);
|
||||
@@ -16343,7 +16343,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
||||
handleKeyDown(e) {
|
||||
if (e.keyCode == 27) {
|
||||
this.setState({
|
||||
value: this.props.value,
|
||||
value: this.props.value || '',
|
||||
visible: false
|
||||
});
|
||||
if (this.props.onFinished) {
|
||||
@@ -16374,7 +16374,7 @@ class VisiblePassword extends (react__WEBPACK_IMPORTED_MODULE_0___default().Pure
|
||||
onBlur: this.handleEditingFinished
|
||||
}, react__WEBPACK_IMPORTED_MODULE_0___default().createElement("input", {
|
||||
className: "with-visibility",
|
||||
type: this.state.visible ? "text" : "password",
|
||||
type: this.state.visible ? 'text' : 'password',
|
||||
value: this.state.value,
|
||||
placeholder: this.props.placeholder,
|
||||
required: this.props.required ? 'required' : '',
|
||||
|
||||
File diff suppressed because one or more lines are too long
+1
-1
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user