From 1f56c02164ab99b35db2dd40f43e48491faa3052 Mon Sep 17 00:00:00 2001 From: Matt Brookes Date: Sun, 1 Nov 2015 23:02:21 +0000 Subject: [PATCH] =?UTF-8?q?Revert=20"Changes=20in=20v0.2.3=20was=20a=20mis?= =?UTF-8?q?take.=20This=20commit=20fixes=20that=20by=20using=20the=20?= =?UTF-8?q?=E2=80=A6"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- formsy-material-ui.jsx | 49 ++++-------------------------------------- index.js | 43 ++---------------------------------- 2 files changed, 6 insertions(+), 86 deletions(-) diff --git a/formsy-material-ui.jsx b/formsy-material-ui.jsx index ee11e0c..d2941d1 100644 --- a/formsy-material-ui.jsx +++ b/formsy-material-ui.jsx @@ -100,56 +100,15 @@ let FormsySelect = React.createClass({ }); let FormsyText = React.createClass({ - displayName: 'FormsyText', - - propTypes: { - name: React.PropTypes.string.isRequired, - validations: React.PropTypes.string, - validationError: React.PropTypes.string, - hintText: React.PropTypes.string, - floatingLabelText: React.PropTypes.string - }, - - handleChange: function handleChange(event) { - if(this.getErrorMessage() != null){ - this.setValue(event.currentTarget.value); - } - else{ - if (this.isValidValue(event.target.value)) { - this.setValue(event.target.value); - } - else{ - this.setState({ - _value: event.currentTarget.value, - _isPristine: false - }); - } - } - }, - - handleValueChange: function handleValueChange(event, value) { - this.setValue(value); - }, - - handleBlur: function handleBlur(event) { - this.setValue(event.currentTarget.value); - }, - - handleEnterKeyDown: function handleEnterKeyDown(event) { - this.setValue(event.currentTarget.value); - }, - - mixins: [ Formsy.Mixin ], + mixins: [ Formsy.Mixin, FormComponentMixin ], render: function () { return ( + onBlur={this.handleChange} + errorText={this.getErrorMessage()} + value={this.getValue()} /> ); } }); diff --git a/index.js b/index.js index eb443b1..9440d5b 100644 --- a/index.js +++ b/index.js @@ -115,50 +115,11 @@ var FormsySelect = React.createClass({ var FormsyText = React.createClass({ displayName: 'FormsyText', - propTypes: { - name: React.PropTypes.string.isRequired, - validations: React.PropTypes.string, - validationError: React.PropTypes.string, - hintText: React.PropTypes.string, - floatingLabelText: React.PropTypes.string - }, - - handleChange: function handleChange(event) { - if(this.getErrorMessage() != null){ - this.setValue(event.currentTarget.value); - } - else{ - if (this.isValidValue(event.target.value)) { - this.setValue(event.target.value); - } - else{ - this.setState({ - _value: event.currentTarget.value, - _isPristine: false - }); - } - } - }, - - handleValueChange: function handleValueChange(event, value) { - this.setValue(value); - }, - - handleBlur: function handleBlur(event) { - this.setValue(event.currentTarget.value); - }, - - handleEnterKeyDown: function handleEnterKeyDown(event) { - this.setValue(event.currentTarget.value); - }, - - mixins: [Formsy.Mixin], + mixins: [Formsy.Mixin, FormComponentMixin], render: function render() { return React.createElement(TextField, _extends({}, this.props, { - onChange: this.handleChange, - onBlur: this.handleBlur, - onEnterKeyDown:this.handleEnterKeyDown, + onBlur: this.handleChange, errorText: this.getErrorMessage(), value: this.getValue() })); }