Skip to content

Commit

Permalink
fix going back from amount selection screen
Browse files Browse the repository at this point in the history
  • Loading branch information
KKA11010 committed Mar 27, 2024
1 parent 0eda380 commit 987a782
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 6 deletions.
2 changes: 2 additions & 0 deletions src/model/nav.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ export type RootStackParamList = {
balance: number
lnurl?: ILnurlNavData
targetMint?: IMintUrl
scanned?: boolean
}
selectNostrAmount: {
mint: IMintUrl
Expand Down Expand Up @@ -125,6 +126,7 @@ export type RootStackParamList = {
'qr processing': {
tokenInfo?: ITokenInfo
token?: string
scanned?: boolean
ln?: {
invoice: string
mint?: IMintUrl
Expand Down
4 changes: 2 additions & 2 deletions src/screens/Payment/SelectAmount.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ import { Animated, KeyboardAvoidingView, TextInput, View } from 'react-native'
import { s, ScaledSheet, vs } from 'react-native-size-matters'

export default function SelectAmountScreen({ navigation, route }: TSelectAmountPageProps) {
const { mint, balance, lnurl, isMelt, isSendEcash, nostr, isSwap, targetMint } = route.params
const { mint, balance, lnurl, isMelt, isSendEcash, nostr, isSwap, targetMint, scanned } = route.params
const { openPromptAutoClose } = usePromptContext()
const { t } = useTranslation([NS.wallet])
const { color, highlight } = useThemeContext()
Expand Down Expand Up @@ -171,7 +171,7 @@ export default function SelectAmountScreen({ navigation, route }: TSelectAmountP
<Screen
screenName={t(getScreenName(), { ns: NS.common })}
withBackBtn
handlePress={() => navigation.goBack()}
handlePress={() => scanned ? navigation.navigate('qr scan', {}) : navigation.goBack()}
mintBalance={balance}
disableMintBalance={isMelt || isSwap}
handleMintBalancePress={() => setAmount(`${balance}`)}
Expand Down
8 changes: 5 additions & 3 deletions src/screens/QRScan/QRProcessing.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ import { ScaledSheet } from 'react-native-size-matters'
export default function QRProcessingScreen({ navigation, route }: TQRProcessingPageProps) {
const { t } = useTranslation([NS.mints])
const { color } = useThemeContext()
const { tokenInfo, token, ln, lnurl } = route.params
const { tokenInfo, token, ln, lnurl, scanned } = route.params

const getProcessingtxt = () => {
if (token && tokenInfo) { return 'claiming' }
Expand Down Expand Up @@ -84,6 +84,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP
mint: lnurl?.mint,
balance: lnurl?.balance,
isMelt: true,
scanned,
lnurl: {
userInput: lnurl.data,
url: lnurl.url,
Expand All @@ -103,7 +104,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP
mintsWithBal,
isMelt: true,
allMintsEmpty: true,
scanned: true,
scanned,
lnurl: {
userInput: lnurl.data,
url: lnurl.url,
Expand All @@ -129,6 +130,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP
mint: nonEmptyMint[0],
balance: nonEmptyMint[0].amount,
isMelt: true,
scanned,
lnurl: {
userInput: lnurl.data,
url: lnurl.url,
Expand All @@ -143,7 +145,7 @@ export default function QRProcessingScreen({ navigation, route }: TQRProcessingP
mintsWithBal,
allMintsEmpty: !nonEmptyMint.length,
isMelt: true,
scanned: true,
scanned,
lnurl: {
userInput: lnurl.data,
url: lnurl.url,
Expand Down
2 changes: 1 addition & 1 deletion src/screens/QRScan/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ export default function QRScanPage({ navigation, route }: TQRScanPageProps) {
if (!decoded) {
return openPromptAutoClose({ msg: t('unknownType') + ` - decoded LNURL: "${decoded}"` })
}
return navigation.navigate('qr processing', { lnurl: { data, mint, balance, url: decoded } })
return navigation.navigate('qr processing', { lnurl: { data, mint, balance, url: decoded }, scanned: true })
}
// handle LN invoice
try {
Expand Down

0 comments on commit 987a782

Please sign in to comment.