Skip to content

Commit

Permalink
Merge pull request #196 from dex157/fix_validation_color
Browse files Browse the repository at this point in the history
correct underline color for validated textfiled
  • Loading branch information
Ryan Blakeley authored Jul 18, 2017
2 parents 6845c21 + 2eb1a89 commit ea408ef
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/FormsyText.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ const FormsyText = createClass({
defaultProps: {
underlineFocusStyle: {},
underlineStyle: {},
validationColor: '#4CAF50',
},

getInitialState() {
Expand Down Expand Up @@ -69,10 +70,6 @@ const FormsyText = createClass({
return props.value || props.defaultValue || '';
},

validationColor(props = this.props) {
return props.validationColor || '#4CAF50';
},

handleBlur(event) {
this.setValue(event.currentTarget.value);
delete this.changeValue;
Expand Down Expand Up @@ -122,6 +119,7 @@ const FormsyText = 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;
Expand All @@ -138,8 +136,8 @@ const FormsyText = 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}
/>
);
},
Expand Down

0 comments on commit ea408ef

Please sign in to comment.