Skip to content

Commit

Permalink
added amount to invoice QR code if it has amount
Browse files Browse the repository at this point in the history
  • Loading branch information
myxmaster committed Oct 3, 2023
1 parent da4c75a commit d87eb5d
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 7 deletions.
2 changes: 1 addition & 1 deletion components/CollapsedQR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ interface CollapsedQRProps {
expanded?: boolean;
textBottom?: boolean;
truncateLongValue?: boolean;
satAmount?: string;
satAmount?: string | number;
}

interface CollapsedQRState {
Expand Down
5 changes: 4 additions & 1 deletion views/PaymentRequest.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,10 @@ export default class PaymentRequest extends React.Component<
<Icon
name="qr-code"
onPress={() => {
navigation.navigate('QR', { value: paymentRequest });
navigation.navigate('QR', {
value: paymentRequest,
satAmount: requestAmount
});
}}
color={themeColor('text')}
underlayColor="transparent"
Expand Down
20 changes: 15 additions & 5 deletions views/QR.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -11,20 +11,25 @@ interface QRProps {

interface QRState {
value: string;
satAmount?: number;
}

export default class QR extends React.PureComponent<QRProps, QRState> {
constructor(props: any) {
super(props);
const value: string = this.props.navigation.getParam('value', '');
const satAmount: number | undefined =
this.props.navigation.getParam('satAmount');

this.state = {
value
value,
satAmount
};
}

render() {
const { navigation } = this.props;
const { value } = this.state;
const { value, satAmount } = this.state;

return (
<Screen>
Expand All @@ -38,11 +43,16 @@ export default class QR extends React.PureComponent<QRProps, QRState> {
/>
<View
style={{
top: 5,
padding: 15
paddingLeft: 15,
paddingRight: 15
}}
>
<CollapsedQR value={value} expanded textBottom />
<CollapsedQR
value={value}
satAmount={satAmount}
expanded
textBottom
/>
</View>
</Screen>
);
Expand Down

0 comments on commit d87eb5d

Please sign in to comment.