Skip to content

Commit

Permalink
fix: BTC transaction value in Congratulations component
Browse files Browse the repository at this point in the history
  • Loading branch information
TravellerOnTheRun committed Jul 24, 2023
1 parent 94a626c commit cdc9e08
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
15 changes: 10 additions & 5 deletions src/screens/send/SendScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import { useCallback, useEffect } from 'react'
import { Alert, Keyboard, KeyboardAvoidingView, Platform } from 'react-native'
import { useTranslation } from 'react-i18next'
import { useIsFocused } from '@react-navigation/native'
import { convertSatoshiToBtcHuman } from '@rsksmart/rif-wallet-bitcoin'

import { sharedHeaderLeftOptions } from 'navigation/index'
import {
Expand All @@ -26,6 +27,7 @@ import { FeedbackModal } from 'components/feedbackModal'

import { TransactionForm } from './TransactionForm'
import { usePaymentExecutor } from './usePaymentExecutor'
import { TokenSymbol } from '../home/TokenImage'

export const SendScreen = ({
route,
Expand Down Expand Up @@ -146,18 +148,21 @@ export const SendScreen = ({
}
}, [navigation, currentTransaction])

const value =
currentTransaction && currentTransaction.value
? currentTransaction.symbol === TokenSymbol.BTC
? convertSatoshiToBtcHuman(currentTransaction.value)
: currentTransaction.value
: undefined

return (
<KeyboardAvoidingView
style={sharedStyles.screen}
keyboardVerticalOffset={100}
behavior={Platform.OS === 'ios' ? 'padding' : undefined}>
{/* Render Feedback when transaction is PENDING */}
<FeedbackModal
visible={Boolean(
currentTransaction?.status === 'PENDING' &&
currentTransaction.value &&
currentTransaction.symbol,
)}
visible={Boolean(value)}
title={t('transaction_summary_congrats')}
texts={[
`${t('transaction_summary_you_sent')} ${currentTransaction?.value} ${
Expand Down
1 change: 1 addition & 0 deletions src/screens/send/transferBitcoin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ export const transferBitcoin = ({
if (txIdJson.result) {
// success
if (onSetCurrentTransaction) {
//@TODO: make the status a constant value
onSetCurrentTransaction({
status: 'PENDING',
to,
Expand Down

0 comments on commit cdc9e08

Please sign in to comment.