Skip to content

Commit

Permalink
remain editing mode while invalid
Browse files Browse the repository at this point in the history
  • Loading branch information
springuper committed Dec 5, 2016
2 parents fa62a2e + 54ae8fa commit 741c75d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/RIEBase.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export default class RIEBase extends React.Component {
validate: React.PropTypes.func,
handleValidationFail: React.PropTypes.func,
shouldBlockWhileLoading: React.PropTypes.bool,
shouldRemainWhileInvalid: React.PropTypes.bool,
classLoading: React.PropTypes.string,
classEditing: React.PropTypes.string,
classDisabled: React.PropTypes.string,
Expand Down Expand Up @@ -54,7 +55,9 @@ export default class RIEBase extends React.Component {
};

componentWillReceiveProps = (nextProps) => {
if ('value' in nextProps) this.setState({loading: false, editing: false, invalid: false, newValue: null});
if ('value' in nextProps && !(nextProps.shouldRemainWhileInvalid && this.state.invalid)) {
this.setState({loading: false, editing: false, invalid: false, newValue: null});
}
};

commit = (value) => {
Expand Down

0 comments on commit 741c75d

Please sign in to comment.