Skip to content

Commit 7c89d4c

Browse files
committed
fix reset state
1 parent e7a5d8b commit 7c89d4c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

components/FieldCoreBase.tsx

+4
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ export default class FieldCoreBase<
8888
this.setState({ submitted });
8989
}
9090

91+
public resetState = () => {
92+
this.setState({ submitted: false, touched: false });
93+
}
94+
9195
public isValid = () => {
9296
return !this.state.errorMessage && !this.props.errorMessage;
9397
}

components/ValidationContext.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default class ValidationContext extends React.PureComponent<{}> {
2121
}
2222

2323
public reset = (): void => {
24-
this.fields.forEach(f => f.setFormSubmitted(false));
24+
this.fields.forEach(f => f.resetState());
2525
}
2626

2727
private checkValidation = (): boolean => {

package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
"validation",
1010
"material"
1111
],
12-
"version": "1.0.3",
12+
"version": "1.0.5",
1313
"main": "./dist/index.js",
1414
"types": "./dist/index.d.ts",
1515
"license": "MIT",

0 commit comments

Comments
 (0)