Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions mobile/src/features/Swap/useCases/ListOrders/ListOrders.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@ import {isLeft, parseNumberFromText, truncateString} from '@yoroi/common'
import {infoExtractName} from '@yoroi/portfolio'
import {atoms as a, useTheme} from '@yoroi/theme'
import {Api, Portfolio, Swap} from '@yoroi/types'
import {useSelectedWallet} from '@yoroi/wallet-manager'
import {useWalletManager} from '@yoroi/wallet-manager'
import {useSelectedWallet, useWalletManager} from '@yoroi/wallet-manager'

import * as React from 'react'
import {ErrorBoundary} from 'react-error-boundary'
Expand Down
13 changes: 12 additions & 1 deletion mobile/src/ui/ModalError/ModalError.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import {View} from 'react-native'
import {useStrings} from '~/kernel/i18n/useStrings'
import {Button, ButtonType} from '~/ui/Button/Button'
import {Icon} from '~/ui/Icon'
import {useModal} from '~/ui/Modal/context/ModalContext'
import {Space} from '~/ui/Space/Space'
import {Text} from '~/ui/Text/Text'

Expand All @@ -25,8 +26,17 @@ type Props = {
export const ModalError = ({error, resetErrorBoundary, onCancel}: Props) => {
const strings = useStrings()
const {palette: p} = useTheme()
const {closeModal} = useModal()
const message = getErrorMessage(error, strings)

const handleCancel = React.useCallback(() => {
if (onCancel) {
onCancel()
} else {
closeModal()
}
}, [onCancel, closeModal])

return (
<>
<View style={[a.flex_grow, a.align_center, a.justify_center]}>
Expand All @@ -49,8 +59,9 @@ export const ModalError = ({error, resetErrorBoundary, onCancel}: Props) => {
<Button
size="S"
type={ButtonType.Secondary}
onPress={onCancel}
onPress={handleCancel}
title={strings.global.cancel}
disabled={false}
/>

<Space.Width.lg />
Expand Down
Loading