Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
15 commits
Select commit Hold shift + click to select a range
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
25 changes: 24 additions & 1 deletion App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ import { StatusBar } from 'expo-status-bar';
import { GestureHandlerRootView } from 'react-native-gesture-handler';
import { BottomSheetModalProvider } from '@gorhom/bottom-sheet';
import Toast, { BaseToast, ErrorToast, InfoToast } from 'react-native-toast-message';
import { WalletProvider } from './src/contexts/WalletContext';
import { WalletProvider, useWallet } from './src/contexts/WalletContext';
import { NostrProvider } from './src/contexts/NostrContext';
import AppNavigator from './src/navigation/AppNavigator';
import PaymentProgressOverlay from './src/components/PaymentProgressOverlay';

// Render toasts with unlimited-line body so long error messages (e.g. Electrum
// script-verify errors) aren't truncated. Height grows to fit content.
Expand Down Expand Up @@ -43,6 +44,27 @@ const toastConfig = {
),
};

// Renders the global incoming-payment celebration on top of the nav
// stack. Lives inside the WalletProvider so it can subscribe to the
// context's incoming-payment event bus, and above any screen so the
// confetti pops no matter where the user is when a payment lands.
function GlobalIncomingPaymentOverlay() {
const { lastIncomingPayment, clearLastIncomingPayment } = useWallet();
// Key on the event timestamp so a second payment arriving while the
// overlay is still visible remounts the component and re-arms the
// confetti animation. Without this, a second `success` in a row
// wouldn't retrigger the burst (state stays 'success', no transition).
return (
<PaymentProgressOverlay
key={lastIncomingPayment?.at ?? 'idle'}
state={lastIncomingPayment ? 'success' : 'hidden'}
direction="receive"
amountSats={lastIncomingPayment?.amountSats}
onDismiss={clearLastIncomingPayment}
/>
);
Comment thread
BenGWeeks marked this conversation as resolved.
}

export default function App() {
return (
<GestureHandlerRootView style={styles.container}>
Expand All @@ -53,6 +75,7 @@ export default function App() {
<AppNavigator />
</BottomSheetModalProvider>
<Toast topOffset={60} config={toastConfig} />
<GlobalIncomingPaymentOverlay />
</NostrProvider>
</WalletProvider>
</GestureHandlerRootView>
Expand Down
Loading
Loading