Browse Source

Correct reset send modal state when pressing back/retry

master
meriadec 7 years ago
parent
commit
c60e2281d1
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 14
      src/components/modals/Send/index.js

14
src/components/modals/Send/index.js

@ -49,7 +49,6 @@ type State<Transaction> = {
transaction: ?Transaction, transaction: ?Transaction,
optimisticOperation: ?Operation, optimisticOperation: ?Operation,
isAppOpened: boolean, isAppOpened: boolean,
disabledSteps: number[],
errorSteps: number[], errorSteps: number[],
amount: number, amount: number,
error: ?Error, error: ?Error,
@ -126,12 +125,10 @@ const INITIAL_STATE = {
error: null, error: null,
optimisticOperation: null, optimisticOperation: null,
isAppOpened: false, isAppOpened: false,
disabledSteps: [],
errorSteps: [], errorSteps: [],
} }
class SendModal extends PureComponent<Props, State<*>> { class SendModal extends PureComponent<Props, State<*>> {
state = INITIAL_STATE state = INITIAL_STATE
componentWillUnmount() { componentWillUnmount() {
@ -170,7 +167,14 @@ class SendModal extends PureComponent<Props, State<*>> {
handleChangeAppOpened = (isAppOpened: boolean) => this.setState({ isAppOpened }) handleChangeAppOpened = (isAppOpened: boolean) => this.setState({ isAppOpened })
handleChangeTransaction = transaction => this.setState({ transaction }) handleChangeTransaction = transaction => this.setState({ transaction })
handleRetry = () => this.setState({ error: null, errorSteps: [] }) handleRetry = () => {
this.setState({
error: null,
errorSteps: [],
optimisticOperation: null,
isAppOpened: false,
})
}
handleTransactionError = (error: Error) => { handleTransactionError = (error: Error) => {
const stepVerificationIndex = this.STEPS.findIndex(step => step.id === 'verification') const stepVerificationIndex = this.STEPS.findIndex(step => step.id === 'verification')
@ -228,7 +232,6 @@ class SendModal extends PureComponent<Props, State<*>> {
stepId, stepId,
account, account,
isAppOpened, isAppOpened,
disabledSteps,
errorSteps, errorSteps,
bridge, bridge,
transaction, transaction,
@ -269,7 +272,6 @@ class SendModal extends PureComponent<Props, State<*>> {
onStepChange={this.handleStepChange} onStepChange={this.handleStepChange}
onClose={onClose} onClose={onClose}
steps={this.STEPS} steps={this.STEPS}
disabledSteps={disabledSteps}
errorSteps={errorSteps} errorSteps={errorSteps}
{...addtionnalProps} {...addtionnalProps}
> >

Loading…
Cancel
Save