From 2eb1a89bb25005eec2674799f11e029e2bb9afd0 Mon Sep 17 00:00:00 2001 From: Artem Samofalov Date: Thu, 16 Feb 2017 16:11:53 +0700 Subject: [PATCH] fix validation color for underline --- src/FormsyText.jsx | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/src/FormsyText.jsx b/src/FormsyText.jsx index 1a9fd78..64ef3fc 100644 --- a/src/FormsyText.jsx +++ b/src/FormsyText.jsx @@ -28,6 +28,7 @@ const FormsyText = React.createClass({ defaultProps: { underlineFocusStyle: {}, underlineStyle: {}, + validationColor: '#4CAF50', }, getInitialState() { @@ -67,10 +68,6 @@ const FormsyText = React.createClass({ return props.value || props.defaultValue || ''; }, - validationColor(props = this.props) { - return props.validationColor || '#4CAF50'; - }, - handleBlur(event) { this.setValue(event.currentTarget.value); delete this.changeValue; @@ -120,6 +117,7 @@ const FormsyText = React.createClass({ validationError, // eslint-disable-line no-unused-vars validationErrors, // eslint-disable-line no-unused-vars value, // eslint-disable-line no-unused-vars + validationColor, ...rest } = this.props; const { isRequired, isPristine, isValid, isFormSubmitted } = this; @@ -136,8 +134,8 @@ const FormsyText = React.createClass({ onKeyDown={this.handleKeyDown} ref={this.setMuiComponentAndMaybeFocus} value={this.state.value} - underlineStyle={this.state.isValid ? { color: this.validationColor() } : underlineStyle} - underlineFocusStyle={this.state.isValid ? { color: this.validationColor() } : underlineFocusStyle} + underlineStyle={this.state.isValid ? { borderColor: validationColor } : underlineStyle} + underlineFocusStyle={this.state.isValid ? { borderColor: validationColor } : underlineFocusStyle} /> ); },