From fdc42e4dbb258d24c1e9d3977a31ca1e1913279f Mon Sep 17 00:00:00 2001 From: Michal S Date: Mon, 20 Jan 2025 15:28:08 +0100 Subject: [PATCH] feat(wallet-mobile): Add slide in and out animations (#3791) --- apps/wallet-mobile/src/AppNavigator.tsx | 4 +- .../useCases/NotificationUIHandler.tsx | 5 +- .../useCases/NotificationsDevScreen.tsx | 4 +- .../useCases/common/NotificationPopup.tsx | 9 +-- .../useCases/common/NotificationStack.tsx | 2 +- .../useCases/common/SwipeOutWrapper.tsx | 68 +++++++++++++++++-- .../src/legacy/Dashboard/UserSummary.json | 16 ++--- .../reactjs/useReceivedNotificationEvents.ts | 4 +- 8 files changed, 85 insertions(+), 27 deletions(-) diff --git a/apps/wallet-mobile/src/AppNavigator.tsx b/apps/wallet-mobile/src/AppNavigator.tsx index 3c0e6bbd9a..f033d3f91a 100644 --- a/apps/wallet-mobile/src/AppNavigator.tsx +++ b/apps/wallet-mobile/src/AppNavigator.tsx @@ -119,8 +119,6 @@ export const AppNavigator = () => { onReady={onReady} ref={navRef} > - - { )} + + ) } diff --git a/apps/wallet-mobile/src/features/Notifications/useCases/NotificationUIHandler.tsx b/apps/wallet-mobile/src/features/Notifications/useCases/NotificationUIHandler.tsx index 6fb4491e31..ee29f46836 100644 --- a/apps/wallet-mobile/src/features/Notifications/useCases/NotificationUIHandler.tsx +++ b/apps/wallet-mobile/src/features/Notifications/useCases/NotificationUIHandler.tsx @@ -9,7 +9,6 @@ import {NotificationPopup} from './common/NotificationPopup' import {NotificationStack} from './common/NotificationStack' const displayLimit = 3 -const displayTime = 20 * 1000 export const NotificationUIHandler = () => { const enabled = useNotificationDisplaySettings() @@ -29,6 +28,7 @@ export const NotificationUIHandler = () => { event={event} onCancel={() => removeEvent(event.id)} onPress={() => removeEvent(event.id)} + onExpired={() => removeEvent(event.id)} /> ))} @@ -38,14 +38,13 @@ export const NotificationUIHandler = () => { const useCollectNewNotifications = ({enabled}: {enabled: boolean}) => { const manager = useNotificationManager() const walletManager = useWalletManager() - const selectedWalletId = walletManager.selected.wallet?.id + const selectedWalletId = walletManager.selected.wallet?.id ?? '' const [events, setEvents] = React.useState([]) React.useEffect(() => { if (!enabled) return const pushEvent = (event: Notifications.Event) => { setEvents((e) => [...e, event]) - setTimeout(() => setEvents((e) => e.filter((ev) => ev.id !== event.id)), displayTime) } const subscription = manager.newEvents$.subscribe((event) => { diff --git a/apps/wallet-mobile/src/features/Notifications/useCases/NotificationsDevScreen.tsx b/apps/wallet-mobile/src/features/Notifications/useCases/NotificationsDevScreen.tsx index 43efc4f63a..4676fa8049 100644 --- a/apps/wallet-mobile/src/features/Notifications/useCases/NotificationsDevScreen.tsx +++ b/apps/wallet-mobile/src/features/Notifications/useCases/NotificationsDevScreen.tsx @@ -30,7 +30,7 @@ export const NotificationsDevScreen = () => { const Screen = () => { const manager = useNotificationManager() const walletManager = useWalletManager() - const selectedWalletId = walletManager.selected.wallet?.id ?? 'walletId' + const selectedWalletId = walletManager.selected.wallet?.id ?? '' const handleOnTriggerTransactionReceived = () => { manager.events.push( @@ -50,7 +50,7 @@ const Screen = () => { Notifications Playground -