From ad0d65766b0c47290b172fa60686a063f0c3b80e Mon Sep 17 00:00:00 2001 From: Patricio Vicens Date: Tue, 14 May 2024 18:14:22 -0300 Subject: [PATCH] fix navigation crash after mint campaign --- .../Notification/Notifications/AnnouncementNotification.tsx | 6 +++++- apps/mobile/src/hooks/useNavigateToCommunityScreen.ts | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apps/mobile/src/components/Notification/Notifications/AnnouncementNotification.tsx b/apps/mobile/src/components/Notification/Notifications/AnnouncementNotification.tsx index e176e1a281..7e772abf1f 100644 --- a/apps/mobile/src/components/Notification/Notifications/AnnouncementNotification.tsx +++ b/apps/mobile/src/components/Notification/Notifications/AnnouncementNotification.tsx @@ -1,3 +1,4 @@ +import { useNavigation } from '@react-navigation/native'; import { ResizeMode } from 'expo-av'; import { useColorScheme } from 'nativewind'; import { useCallback, useEffect } from 'react'; @@ -12,19 +13,22 @@ import MintCampaignBottomSheet from '~/components/Mint/MintCampaign/MintCampaign import { BaseM } from '~/components/Text'; import { useBottomSheetModalActions } from '~/contexts/BottomSheetModalContext'; import { useSanityAnnouncementContext } from '~/contexts/SanityAnnouncementContext'; +import { MainTabStackNavigatorProp } from '~/navigation/types'; // Displays announcement content from Sanity export default function AnnouncementNotification() { const { announcement, markAnnouncementAsSeen, dismissAnnouncement } = useSanityAnnouncementContext(); const { showBottomSheetModal } = useBottomSheetModalActions(); + const navigation = useNavigation(); const handlePress = useCallback(() => { if (!announcement) return; showBottomSheetModal({ content: , + navigationContext: navigation, }); - }, [announcement, showBottomSheetModal]); + }, [announcement, navigation, showBottomSheetModal]); const handleDismissPress = useCallback(() => { dismissAnnouncement(); diff --git a/apps/mobile/src/hooks/useNavigateToCommunityScreen.ts b/apps/mobile/src/hooks/useNavigateToCommunityScreen.ts index 23e17529b3..100c52cbea 100644 --- a/apps/mobile/src/hooks/useNavigateToCommunityScreen.ts +++ b/apps/mobile/src/hooks/useNavigateToCommunityScreen.ts @@ -26,7 +26,7 @@ export function useNavigateToCommunityScreen() { const { chain, contractAddress, subtype, projectId } = extractRelevantMetadataFromCommunity(community); - if (navigationType === 'push') { + if (navigation.push && navigationType === 'push') { navigation.push('Community', { subtype, contractAddress,