Skip to content

Commit 57a06c1

Browse files
author
Edward Xiao
committed
- nextProps.validate === true && prevState.validate === false -> nextProps.validate !== prevState.validate. Fix for issue #17.
1 parent 3c20e0e commit 57a06c1

16 files changed

+41
-37
lines changed

lib/components/Checkbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ function (_React$Component) {
134134
_createClass(Index, [{
135135
key: "componentDidUpdate",
136136
value: function componentDidUpdate(prevProps, prevState) {
137-
if (this.state.validate === true && prevState.validate === false) {
137+
if (this.state.validate !== prevState.validate) {
138138
this.check();
139139
}
140140
}
@@ -335,7 +335,7 @@ function (_React$Component) {
335335
}], [{
336336
key: "getDerivedStateFromProps",
337337
value: function getDerivedStateFromProps(nextProps, prevState) {
338-
if (nextProps.validate === true && prevState.validate === false) {
338+
if (nextProps.validate !== prevState.validate) {
339339
return {
340340
validate: nextProps.validate
341341
};

lib/components/Radiobox.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,8 @@ function (_React$Component) {
140140
_createClass(Index, [{
141141
key: "componentDidUpdate",
142142
value: function componentDidUpdate(prevProps, prevState) {
143-
if (this.state.validate === true && prevState.validate === false) {
143+
if (this.state.validate !== prevState.validate) {
144+
debugger;
144145
this.check();
145146
}
146147
}
@@ -336,7 +337,7 @@ function (_React$Component) {
336337
}], [{
337338
key: "getDerivedStateFromProps",
338339
value: function getDerivedStateFromProps(nextProps, prevState) {
339-
if (nextProps.validate === true && prevState.validate === false) {
340+
if (nextProps.validate !== prevState.validate) {
340341
return {
341342
validate: nextProps.validate
342343
};

lib/components/Select.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ function (_React$Component) {
202202
}
203203
}
204204

205-
if (this.state.validate === true && prevState.validate === false) {
205+
if (this.state.validate !== prevState.validate) {
206206
this.check();
207207
}
208208
}
@@ -731,7 +731,7 @@ function (_React$Component) {
731731
}], [{
732732
key: "getDerivedStateFromProps",
733733
value: function getDerivedStateFromProps(nextProps, prevState) {
734-
if (nextProps.validate === true && prevState.validate === false) {
734+
if (nextProps.validate !== prevState.validate) {
735735
return {
736736
validate: nextProps.validate
737737
};

lib/components/Textarea.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ function (_React$Component) {
164164
_createClass(Index, [{
165165
key: "componentDidUpdate",
166166
value: function componentDidUpdate(prevProps, prevState) {
167-
if (this.state.validate === true && prevState.validate === false) {
167+
if (this.state.validate !== prevState.validate) {
168168
this.check();
169169
}
170170
}
@@ -431,7 +431,7 @@ function (_React$Component) {
431431
}], [{
432432
key: "getDerivedStateFromProps",
433433
value: function getDerivedStateFromProps(nextProps, prevState) {
434-
if (nextProps.validate === true && prevState.validate === false) {
434+
if (nextProps.validate !== prevState.validate) {
435435
return {
436436
validate: nextProps.validate
437437
};

lib/components/Textbox.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -166,7 +166,7 @@ function (_React$Component) {
166166
_createClass(Index, [{
167167
key: "componentDidUpdate",
168168
value: function componentDidUpdate(prevProps, prevState) {
169-
if (this.state.validate === true && prevState.validate === false) {
169+
if (this.state.validate !== prevState.validate) {
170170
this.check();
171171
}
172172
}
@@ -526,7 +526,7 @@ function (_React$Component) {
526526
}], [{
527527
key: "getDerivedStateFromProps",
528528
value: function getDerivedStateFromProps(nextProps, prevState) {
529-
if (nextProps.validate === true && prevState.validate === false) {
529+
if (nextProps.validate !== prevState.validate) {
530530
return {
531531
validate: nextProps.validate
532532
};

lib/react-inputs-validation.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/react-inputs-validation.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "react-inputs-validation",
3-
"version": "2.1.5",
4-
"description": "a react inputs validation component",
3+
"version": "2.1.6",
4+
"description": "React inputs validation component",
55
"main": "index.js",
66
"repository": {
77
"type": "git",

0 commit comments

Comments
 (0)