Skip to content

Commit

Permalink
Support canceling onContinue props
Browse files Browse the repository at this point in the history
Resolve Evo-Forge#53
  • Loading branch information
Son Tran-Nguyen committed Apr 24, 2016
1 parent 8d4729c commit 7d9648c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
15 changes: 9 additions & 6 deletions components/essence-stepper/lib/stepper.js
Expand Up @@ -71,14 +71,17 @@ var Stepper = (function (_React$Component) {
key: 'continueStepper',
value: function continueStepper(callback) {
var nextStep = this.state.currentStep + 1;

this.setState({
selected: nextStep,
currentStep: nextStep
});
var advanced = true;

if (callback) {
return callback(nextStep);
advanced = callback(nextStep) || true;
}

if (advanced) {
this.setState({
selected: nextStep,
currentStep: nextStep
});
}
}
}, {
Expand Down
15 changes: 9 additions & 6 deletions components/essence-stepper/src/stepper.jsx
Expand Up @@ -45,14 +45,17 @@ class Stepper extends React.Component {

continueStepper(callback) {
let nextStep = this.state.currentStep+1;

this.setState({
selected: nextStep,
currentStep: nextStep
});
let advanced = true;

if (callback) {
return callback(nextStep);
advanced = callback(nextStep) || true;
}

if (advanced) {
this.setState({
selected: nextStep,
currentStep: nextStep
});
}
}

Expand Down

1 comment on commit 7d9648c

@sntran
Copy link
Collaborator

@sntran sntran commented on 7d9648c Apr 24, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is wrong. New commit pushed to correct this.

Please sign in to comment.