Fixed updating of props bug

This commit is contained in:
Christian Alfoni 2014-10-29 16:10:04 +01:00
parent 5bdfc8235d
commit 874fe8f716
4 changed files with 13 additions and 2 deletions

View File

@ -65,6 +65,10 @@ The main concept is that forms, inputs and validation is done very differently a
## <a name="changes">Changes</a>
**0.2.2**:
- Fixed bug with updating the props
**0.2.1**:
- Cancel button displays if onCancel handler is defined

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.2.1",
"version": "0.2.2",
"main": "src/main.js",
"dependencies": {
"react": "^0.11.2"

View File

@ -1,6 +1,6 @@
{
"name": "formsy-react",
"version": "0.2.1",
"version": "0.2.2",
"description": "A form input builder and validator for React JS",
"main": "src/main.js",
"scripts": {

View File

@ -100,6 +100,13 @@ Formsy.Mixin = {
this.props._attachToForm(this);
},
// We have to make the validate method is kept when new props are added
componentWillReceiveProps: function (nextProps) {
nextProps._attachToForm = this.props._attachToForm;
nextProps._detachFromForm = this.props._detachFromForm;
nextProps._validate = this.props._validate;
},
// Detach it when component unmounts
componentWillUnmount: function () {
this.props._detachFromForm(this);