Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions src/components/AddToWalletButton/index.native.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import React, {useCallback, useEffect, useState} from 'react';
import {Alert, View} from 'react-native';
import ActivityIndicator from '@components/ActivityIndicator';
import Text from '@components/Text';
import useAppFocusEvent from '@hooks/useAppFocusEvent';
import useLocalize from '@hooks/useLocalize';
import useThemeStyles from '@hooks/useThemeStyles';
import {getPaymentMethods} from '@libs/actions/PaymentMethods';
Expand Down Expand Up @@ -61,6 +62,16 @@ function AddToWalletButton({card, cardHolderName, cardDescription, style}: AddTo
checkIfCardIsInWallet();
}, [checkIfCardIsInWallet, isCardAvailable, card]);

// Recheck card status when app regains focus in case user manually adds card to wallet outside the app
useAppFocusEvent(
useCallback(() => {
if (!isCardAvailable) {
return;
}
checkIfCardIsInWallet();
}, [checkIfCardIsInWallet, isCardAvailable]),
);

useEffect(() => {
if (!isCardAvailable) {
return;
Expand Down
Loading