From 874fe8f71666e80a3bf025be99fa0cfd3c455535 Mon Sep 17 00:00:00 2001 From: Christian Alfoni Date: Wed, 29 Oct 2014 16:10:04 +0100 Subject: [PATCH] Fixed updating of props bug --- README.md | 4 ++++ bower.json | 2 +- package.json | 2 +- src/main.js | 7 +++++++ 4 files changed, 13 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe30121..2bc1ee1 100644 --- a/README.md +++ b/README.md @@ -65,6 +65,10 @@ The main concept is that forms, inputs and validation is done very differently a ## Changes +**0.2.2**: + + - Fixed bug with updating the props + **0.2.1**: - Cancel button displays if onCancel handler is defined diff --git a/bower.json b/bower.json index d48612b..889c1b9 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "formsy-react", - "version": "0.2.1", + "version": "0.2.2", "main": "src/main.js", "dependencies": { "react": "^0.11.2" diff --git a/package.json b/package.json index ba62f81..9dd3c89 100644 --- a/package.json +++ b/package.json @@ -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": { diff --git a/src/main.js b/src/main.js index 09f0057..109958a 100644 --- a/src/main.js +++ b/src/main.js @@ -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);