Skip to content

Commit

Permalink
display amount and conversion on Receive QR code screen
Browse files Browse the repository at this point in the history
  • Loading branch information
myxmaster committed Sep 27, 2023
1 parent 431a260 commit da4c75a
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 3 deletions.
21 changes: 19 additions & 2 deletions components/CollapsedQR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ import QRCode from 'react-native-qrcode-svg';

import HCESession, { NFCContentType, NFCTagType4 } from 'react-native-hce';

import Button from './../components/Button';
import Amount from './Amount';
import Button from './Button';
import CopyButton from './CopyButton';
import { localeString } from './../utils/LocaleUtils';
import { themeColor } from './../utils/ThemeUtils';
import Touchable from './Touchable';
import Conversion from './Conversion';

const logo = require('../assets/images/Launcher.png');

Expand Down Expand Up @@ -51,6 +53,7 @@ interface CollapsedQRProps {
expanded?: boolean;
textBottom?: boolean;
truncateLongValue?: boolean;
satAmount?: string;
}

interface CollapsedQRState {
Expand Down Expand Up @@ -117,13 +120,27 @@ export default class CollapsedQR extends React.Component<
hideText,
expanded,
textBottom,
truncateLongValue
truncateLongValue,
satAmount
} = this.props;

const { width, height } = Dimensions.get('window');

return (
<React.Fragment>
{satAmount && (
<View
style={{
flexDirection: 'column',
alignItems: 'center'
}}
>
<Amount sats={satAmount} toggleable></Amount>
<View>
<Conversion sats={satAmount} sensitive />
</View>
</View>
)}
{!hideText && !textBottom && (
<ValueText
value={value}
Expand Down
10 changes: 9 additions & 1 deletion views/Receive.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1307,7 +1307,7 @@ export default class Receive extends React.Component<
</TouchableOpacity>
)}
{haveInvoice && !creatingInvoiceError && (
<View style={{ marginTop: 10 }}>
<View>
{selectedIndex == 0 &&
!belowDustLimit &&
haveUnifiedInvoice && (
Expand All @@ -1319,6 +1319,7 @@ export default class Receive extends React.Component<
expanded
textBottom
truncateLongValue
satAmount={satAmount}
/>
)}
{selectedIndex == 1 &&
Expand All @@ -1333,6 +1334,7 @@ export default class Receive extends React.Component<
expanded
textBottom
truncateLongValue
satAmount={satAmount}
/>
)}
{selectedIndex == 2 &&
Expand All @@ -1347,6 +1349,11 @@ export default class Receive extends React.Component<
expanded
textBottom
truncateLongValue
satAmount={
satAmount === '0'
? undefined
: satAmount
}
/>
)}
{selectedIndex !== 2 &&
Expand All @@ -1361,6 +1368,7 @@ export default class Receive extends React.Component<
expanded
textBottom
truncateLongValue
satAmount={satAmount}
/>
)}
<View
Expand Down

0 comments on commit da4c75a

Please sign in to comment.