Skip to content

Commit

Permalink
fix navigation crash after mint campaign (#2466)
Browse files Browse the repository at this point in the history
  • Loading branch information
pvicensSpacedev authored May 15, 2024
1 parent 5ae8213 commit 6f344c5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { useNavigation } from '@react-navigation/native';
import { ResizeMode } from 'expo-av';
import { useColorScheme } from 'nativewind';
import { useCallback, useEffect } from 'react';
Expand All @@ -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<MainTabStackNavigatorProp>();

const handlePress = useCallback(() => {
if (!announcement) return;
showBottomSheetModal({
content: <MintCampaignBottomSheet projectInternalId={announcement.internal_id} />,
navigationContext: navigation,
});
}, [announcement, showBottomSheetModal]);
}, [announcement, navigation, showBottomSheetModal]);

const handleDismissPress = useCallback(() => {
dismissAnnouncement();
Expand Down
2 changes: 1 addition & 1 deletion apps/mobile/src/hooks/useNavigateToCommunityScreen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 6f344c5

Please sign in to comment.