diff --git a/src/components/Stepper/Controls/index.jsx b/src/components/Stepper/Controls/index.jsx index ebcbd2cf..fd96b62d 100644 --- a/src/components/Stepper/Controls/index.jsx +++ b/src/components/Stepper/Controls/index.jsx @@ -6,16 +6,16 @@ type ControlProps = { next: string, onPrevious: () => void, firstPage: boolean, - submitting: boolean, + disabled: boolean, } const ControlButtons = ({ - next, firstPage, onPrevious, submitting, + next, firstPage, onPrevious, disabled, }: ControlProps) => ( @@ -37,16 +37,16 @@ type Props = { onPrevious: () => void, firstPage: boolean, lastPage: boolean, - submitting: boolean, + disabled: boolean, } const Controls = ({ - finishedTx, finishedButton, onPrevious, firstPage, lastPage, submitting, + finishedTx, finishedButton, onPrevious, firstPage, lastPage, disabled, }: Props) => ( finishedTx ? {finishedButton} : { page: Math.max(state.page - 1, 0), })) - handleSubmit = (values: Object) => { + handleSubmit = async (values: Object) => { const { children, onSubmit } = this.props const { page } = this.state const isLastPage = page === React.Children.count(children) - 1 @@ -113,7 +114,7 @@ class GnoStepper extends React.PureComponent { render() { const { - steps, children, finishedTransaction, finishedButton, classes, + steps, children, finishedTransaction, finishedButton, classes, disabledWhenValidating = false, } = this.props const { page, values } = this.state const activePage = this.getActivePageFrom(children) @@ -136,20 +137,24 @@ class GnoStepper extends React.PureComponent { validation={this.validate} render={activePage} > - {(submitting: boolean) => ( - - - - - - )} + {(submitting: boolean, validating: boolean) => { + const disabled = disabledWhenValidating ? submitting || validating : submitting + + return ( + + + + + + ) + }} ) diff --git a/src/routes/tokens/component/AddToken/index.jsx b/src/routes/tokens/component/AddToken/index.jsx index a6d9ea86..981b68fd 100644 --- a/src/routes/tokens/component/AddToken/index.jsx +++ b/src/routes/tokens/component/AddToken/index.jsx @@ -92,6 +92,7 @@ class AddToken extends React.Component { onSubmit={this.onAddToken} steps={steps} onReset={this.onReset} + disabledWhenValidating > { FirstPage }