1
1
import React , { ReactElement , useMemo , useState } from 'react' ;
2
- import { StyleSheet , View } from 'react-native' ;
2
+ import { StyleSheet , TouchableOpacity , View } from 'react-native' ;
3
3
import { Trans , useTranslation } from 'react-i18next' ;
4
4
5
5
import { Caption13Up , Display , BodyMB , BodyM } from '../../styles/text' ;
@@ -11,7 +11,7 @@ import Percentage from '../../components/Percentage';
11
11
import SwipeToConfirm from '../../components/SwipeToConfirm' ;
12
12
import Money from '../../components/Money' ;
13
13
import PieChart from './PieChart' ;
14
- import { useBalance } from '../../hooks/wallet' ;
14
+ import { useBalance , useSwitchUnit } from '../../hooks/wallet' ;
15
15
import { useAppSelector } from '../../hooks/redux' ;
16
16
import { useCurrency , useDisplayValues } from '../../hooks/displayValues' ;
17
17
import type { LightningScreenProps } from '../../navigation/types' ;
@@ -21,6 +21,7 @@ import {
21
21
selectedNetworkSelector ,
22
22
transactionFeeSelector ,
23
23
} from '../../store/reselect/wallet' ;
24
+ import { unitSelector } from '../../store/reselect/settings' ;
24
25
25
26
const PIE_SIZE = 140 ;
26
27
const PIE_SHIFT = 70 ;
@@ -29,12 +30,14 @@ const QuickConfirm = ({
29
30
navigation,
30
31
route,
31
32
} : LightningScreenProps < 'QuickConfirm' > ) : ReactElement => {
32
- const { spendingAmount, orderId } = route . params ;
33
+ const { spendingAmount, orderId, onChangeUnitOutside } = route . params ;
33
34
const { onchainBalance, lightningBalance } = useBalance ( ) ;
34
35
const { t } = useTranslation ( 'lightning' ) ;
35
36
const orders = useAppSelector ( blocktankOrdersSelector ) ;
36
37
const transactionFee = useAppSelector ( transactionFeeSelector ) ;
37
38
const selectedNetwork = useAppSelector ( selectedNetworkSelector ) ;
39
+ const switchUnit = useSwitchUnit ( ) ;
40
+ const unit = useAppSelector ( unitSelector ) ;
38
41
const [ loading , setLoading ] = useState ( false ) ;
39
42
40
43
const order = useMemo ( ( ) => {
@@ -84,6 +87,9 @@ const QuickConfirm = ({
84
87
onClosePress = { ( ) : void => {
85
88
navigation . navigate ( 'Wallet' ) ;
86
89
} }
90
+ onBackPress = { ( ) : void => {
91
+ onChangeUnitOutside ( unit ) ;
92
+ } }
87
93
/>
88
94
< View style = { styles . content } testID = "Confirm" >
89
95
< Display >
@@ -131,12 +137,12 @@ const QuickConfirm = ({
131
137
</ View >
132
138
</ View >
133
139
134
- < View style = { styles . amountContainer } >
140
+ < TouchableOpacity onPress = { switchUnit } style = { styles . amountContainer } >
135
141
< Caption13Up style = { styles . amountCaption } color = "purple" >
136
142
{ t ( 'spending_label' ) }
137
143
</ Caption13Up >
138
144
< Money sats = { spendingAmount } size = "displayT" symbol = { true } />
139
- </ View >
145
+ </ TouchableOpacity >
140
146
141
147
< SwipeToConfirm
142
148
text = { t ( 'transfer.swipe' ) }
0 commit comments