From f4227e99062242be2efd0b533f6065652cde06a4 Mon Sep 17 00:00:00 2001 From: Brett Sun Date: Wed, 16 Dec 2015 15:17:47 +0100 Subject: [PATCH] Update form's email state if the email prop changes --- js/components/ascribe_forms/form_consign.js | 8 ++++++++ js/components/ascribe_forms/form_loan.js | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/js/components/ascribe_forms/form_consign.js b/js/components/ascribe_forms/form_consign.js index 2f0ebf05..a28d2cff 100644 --- a/js/components/ascribe_forms/form_consign.js +++ b/js/components/ascribe_forms/form_consign.js @@ -41,6 +41,14 @@ let ConsignForm = React.createClass({ }; }, + componentWillReceiveProps(nextProps) { + if (this.props.email !== nextProps.email) { + this.setState({ + email: nextProps.email + }); + } + }, + getFormData() { return this.props.id; }, diff --git a/js/components/ascribe_forms/form_loan.js b/js/components/ascribe_forms/form_loan.js index 53a3bb80..861806ae 100644 --- a/js/components/ascribe_forms/form_loan.js +++ b/js/components/ascribe_forms/form_loan.js @@ -61,6 +61,14 @@ let LoanForm = React.createClass({ }; }, + componentWillReceiveProps(nextProps) { + if (this.props.email !== nextProps.email) { + this.setState({ + email: nextProps.email + }); + } + }, + onChange(state) { this.setState(state); },