Skip to content
This repository was archived by the owner on Jun 23, 2023. It is now read-only.

Commit 2c2c7b4

Browse files
committed
Fixing isValid flag
1 parent 8881412 commit 2c2c7b4

File tree

3 files changed

+11
-9
lines changed

3 files changed

+11
-9
lines changed

dist/react-nice-input-password.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -622,17 +622,18 @@ var NiceInputPassword = function (_React$Component) {
622622
function handleChange(event) {
623623
var target = event.target;
624624

625+
626+
this.setState({
627+
levels: this.handleValidateAndGetLevels(target.value)
628+
});
629+
625630
this.props.onChange({
626631
name: this.props.name,
627632
value: target.value,
628633
isValid: this.state.levels.filter(function (level) {
629634
return level.isValid;
630635
}).length === this.state.levels.length
631636
});
632-
633-
this.setState({
634-
levels: this.handleValidateAndGetLevels(target.value)
635-
});
636637
}
637638

638639
return handleChange;

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "react-nice-input-password",
3-
"version": "2.1.3",
3+
"version": "2.1.4",
44
"description": "React input password component",
55
"main": "dist/react-nice-input-password.js",
66
"style": "dist/react-nice-input-password.css",

src/NiceInputPassword.jsx

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -75,15 +75,16 @@ class NiceInputPassword extends React.Component {
7575

7676
handleChange(event) {
7777
const { target } = event;
78+
79+
this.setState({
80+
levels: this.handleValidateAndGetLevels(target.value),
81+
});
82+
7883
this.props.onChange({
7984
name: this.props.name,
8085
value: target.value,
8186
isValid: this.state.levels.filter(level => level.isValid).length === this.state.levels.length,
8287
});
83-
84-
this.setState({
85-
levels: this.handleValidateAndGetLevels(target.value),
86-
});
8788
}
8889

8990
render() {

0 commit comments

Comments
 (0)