formact
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -110,3 +110,3 @@ 'use strict'; | ||
return errors < 0; | ||
}, _this.onSubmit = function () { | ||
}, _this.onSubmit = function (event) { | ||
var valid = _this.isValid(); | ||
@@ -122,3 +122,3 @@ _this.setState({ | ||
errors: _this.errors | ||
}); | ||
}, event); | ||
} | ||
@@ -125,0 +125,0 @@ }, _temp), _possibleConstructorReturn(_this, _ret); |
{ | ||
"name": "formact", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "A React Context for Form Components", | ||
@@ -63,2 +63,3 @@ "main": "lib/index.js", | ||
"dependencies": { | ||
"formact": "^1.0.1", | ||
"hoist-non-react-statics": "^2.2.1", | ||
@@ -65,0 +66,0 @@ "lodash": "^4.17.4" |
@@ -17,3 +17,3 @@ // @flow | ||
type Props = { | ||
onSubmit: (payload: FormSubmitPayload) => void, | ||
onSubmit: (payload: FormSubmitPayload, event: any) => void, | ||
onChange?: (payload: FormChangePayload) => void, | ||
@@ -127,3 +127,3 @@ component?: ?any, | ||
onSubmit = () => { | ||
onSubmit = (event: any) => { | ||
const valid = this.isValid() | ||
@@ -135,7 +135,10 @@ this.setState({ | ||
if (this.props.onSubmit) { | ||
this.props.onSubmit({ | ||
valid, | ||
fields: this.fields, | ||
errors: this.errors, | ||
}) | ||
this.props.onSubmit( | ||
{ | ||
valid, | ||
fields: this.fields, | ||
errors: this.errors, | ||
}, | ||
event, | ||
) | ||
} | ||
@@ -142,0 +145,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
197750
896
4
+ Addedformact@^1.0.1