Browse Source

Prevent SelectExchange blink

master
meriadec 7 years ago
parent
commit
abbc1d8c96
No known key found for this signature in database GPG Key ID: 1D2FC2305E2CB399
  1. 18
      src/components/SelectExchange.js
  2. 4
      src/components/SettingsPage/sections/Display.js

18
src/components/SelectExchange.js

@ -6,12 +6,11 @@ import type { Exchange } from '@ledgerhq/live-common/lib/countervalues/types'
import logger from 'logger'
import Select from 'components/base/Select'
import Spinner from 'components/base/Spinner'
import Text from 'components/base/Text'
import CounterValues from 'helpers/countervalues'
import type { T } from 'types/common'
class ExchangeSelect extends Component<
class SelectExchange extends Component<
{
from: Currency,
to: Currency,
@ -84,21 +83,20 @@ class ExchangeSelect extends Component<
const options = exchanges ? exchanges.map(e => ({ value: e.id, label: e.name, ...e })) : []
return exchanges && exchanges.length > 0 ? (
return error ? (
<Text ff="Open Sans|SemiBold" color="dark" fontSize={4}>
{t('app:common.error.load')}
</Text>
) : (
<Select
value={options.find(e => e.id === exchangeId)}
options={options}
onChange={onChange}
isLoading={options.length === 0}
{...props}
/>
) : error ? (
<Text ff="Open Sans|SemiBold" color="dark" fontSize={4}>
{t('app:common.error.load')}
</Text>
) : (
<Spinner color="grey" size={24} />
)
}
}
export default translate()(ExchangeSelect)
export default translate()(SelectExchange)

4
src/components/SettingsPage/sections/Display.js

@ -14,7 +14,7 @@ import type { SettingsState as Settings } from 'reducers/settings'
import type { T } from 'types/common'
import Box from 'components/base/Box'
import ExchangeSelect from 'components/SelectExchange'
import SelectExchange from 'components/SelectExchange'
import Select from 'components/base/Select'
import RadioGroup from 'components/base/RadioGroup'
import IconDisplay from 'icons/Display'
@ -163,7 +163,7 @@ class TabProfile extends PureComponent<Props, State> {
options={fiats}
value={cvOption}
/>
<ExchangeSelect
<SelectExchange
small
from={intermediaryCurrency}
to={counterValueCurrency}

Loading…
Cancel
Save