Merge pull request #191 from gnosis/bug/reload-when-sending-tx

BUG: Page reloads when switching screens in send funds modal
This commit is contained in:
Mikhail Mikheev 2019-09-30 13:03:18 +04:00 committed by GitHub
commit c6ea57e6ea
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 20 additions and 7 deletions

View File

@ -1,6 +1,7 @@
// @flow
import React, { useState, useEffect } from 'react'
import React, { useState, useEffect, Suspense } from 'react'
import { List } from 'immutable'
import CircularProgress from '@material-ui/core/CircularProgress'
import cn from 'classnames'
import { withStyles } from '@material-ui/core/styles'
import { type Token } from '~/logic/tokens/store/model/token'
@ -29,7 +30,7 @@ type Props = {
tokens: List<Token>,
selectedToken: string,
createTransaction: Function,
activeScreenType: ActiveScreen
activeScreenType: ActiveScreen,
}
type TxStateType =
@ -51,6 +52,14 @@ const styles = () => ({
},
})
const loaderStyle = {
height: '500px',
width: '100%',
display: 'flex',
justifyContent: 'center',
alignItems: 'center',
}
const Send = ({
onClose,
isOpen,
@ -90,11 +99,15 @@ const Send = ({
description="Send Tokens Form"
handleClose={onClose}
open={isOpen}
paperClassName={cn(
scalableModalSize ? classes.scalableStaticModalWindow : classes.scalableModalWindow,
paperClassName={cn(scalableModalSize ? classes.scalableStaticModalWindow : classes.scalableModalWindow)}
>
<Suspense
fallback={(
<div style={loaderStyle}>
<CircularProgress size={40} />
</div>
)}
>
<>
{activeScreen === 'chooseTxType' && <ChooseTxType onClose={onClose} setActiveScreen={setActiveScreen} />}
{activeScreen === 'sendFunds' && (
<SendFunds
@ -144,7 +157,7 @@ const Send = ({
createTransaction={createTransaction}
/>
)}
</>
</Suspense>
</Modal>
)
}