diff --git a/src/qrcode/QRScanner.tsx b/src/qrcode/QRScanner.tsx index cfaef989fd..8ecbbff04d 100644 --- a/src/qrcode/QRScanner.tsx +++ b/src/qrcode/QRScanner.tsx @@ -70,8 +70,14 @@ export default function QRScanner({ onQRCodeDetected }: QRScannerProps) { const submitModal = () => { Keyboard.dismiss() - onQRCodeDetected({ type: '', data: value }) closeModal() + // add a delay to allow modal to close before calling onQRCodeDetected, + // otherwise nothing is clickable in the next screen this navigates to. A + // better solution is to use onModalHide prop of Modal, but this is an + // emulator only feature, so this is good enough. + setTimeout(() => { + onQRCodeDetected({ type: '', data: value }) + }, 500) } const onModalTextChange = (text: string) => { diff --git a/src/send/utils.test.ts b/src/send/utils.test.ts index eb16678dec..47bcbb0617 100644 --- a/src/send/utils.test.ts +++ b/src/send/utils.test.ts @@ -1,11 +1,9 @@ import BigNumber from 'bignumber.js' import { expectSaga } from 'redux-saga-test-plan' import * as matchers from 'redux-saga-test-plan/matchers' -import { select } from 'redux-saga-test-plan/matchers' import { SendOrigin } from 'src/analytics/types' import { LocalCurrencyCode } from 'src/localCurrency/consts' import { fetchExchangeRate } from 'src/localCurrency/saga' -import { usdToLocalCurrencyRateSelector } from 'src/localCurrency/selectors' import { navigate } from 'src/navigator/NavigationService' import { Screens } from 'src/navigator/Screens' import { UriData, urlFromUriData } from 'src/qrcode/schema' @@ -96,25 +94,6 @@ describe('send/utils', () => { ) }) - it('should throw an error when no local currency exchange rate is available', async () => { - await expect( - expectSaga(handleSendPaymentData, mockData, false, undefined) - .withState( - createMockStore({ - localCurrency: { - usdToLocalRate: null, - }, - }).getState() - ) - .provide([ - [matchers.call.fn(fetchExchangeRate), '1'], - [select(usdToLocalCurrencyRateSelector), '1'], - ]) - .run() - ).rejects.toThrow("Precondition failed: Can't send tokens from payment data") - expect(navigate).not.toHaveBeenCalled() - }) - it('should navigate to SendConfirmation screen when amount and token are sent', async () => { const mockState = createMockStore({}).getState() // 1 PHP in cEUR: 1 (input) / 1.33 (PHP price) / 1.2 (cEUR price) diff --git a/src/send/utils.ts b/src/send/utils.ts index d18ee7e60d..c8ec600058 100644 --- a/src/send/utils.ts +++ b/src/send/utils.ts @@ -13,7 +13,6 @@ import { Screens } from 'src/navigator/Screens' import { UriData, uriDataFromUrl } from 'src/qrcode/schema' import { AddressRecipient, Recipient, RecipientType } from 'src/recipients/recipient' import { updateValoraRecipientCache } from 'src/recipients/reducer' -import { canSendTokensSelector } from 'src/send/selectors' import { TransactionDataInput } from 'src/send/types' import { tokensListSelector } from 'src/tokens/selectors' import { TokenBalance } from 'src/tokens/slice' @@ -97,10 +96,6 @@ export function* handleSendPaymentData( origin: SendOrigin.AppSendFlow, }) } else { - const canSendTokens: boolean = yield* select(canSendTokensSelector) - if (!canSendTokens) { - throw new Error("Precondition failed: Can't send tokens from payment data") - } navigate(Screens.SendEnterAmount, { recipient, isFromScan,