From bbe02dd4c45f3369b17fafeb860c876327196afa Mon Sep 17 00:00:00 2001 From: Johannes Klein Date: Fri, 14 Mar 2025 17:41:57 +0100 Subject: [PATCH] Sharing one photo routes to Match (#2768) --- src/components/PhotoSharing.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/components/PhotoSharing.js b/src/components/PhotoSharing.js index a98524565..5afa31ef4 100644 --- a/src/components/PhotoSharing.js +++ b/src/components/PhotoSharing.js @@ -7,6 +7,7 @@ import type { Node } from "react"; import React, { useCallback, useEffect, useState } from "react"; import { Alert, Platform } from "react-native"; import Observation from "realmModels/Observation"; +import { useLayoutPrefs } from "sharedHooks"; import useStore from "stores/useStore"; const PhotoSharing = ( ): Node => { @@ -17,7 +18,7 @@ const PhotoSharing = ( ): Node => { const resetObservationFlowSlice = useStore( state => state.resetObservationFlowSlice ); const prepareObsEdit = useStore( state => state.prepareObsEdit ); const setPhotoImporterState = useStore( state => state.setPhotoImporterState ); - const isAdvancedSuggestionsMode = useStore( state => state.layout.isAdvancedSuggestionsMode ); + const { isAdvancedSuggestionsMode, isDefaultMode } = useLayoutPrefs(); const [navigationHandled, setNavigationHandled] = useState( null ); const createObservationAndNavToObsEdit = useCallback( async photoUris => { @@ -25,7 +26,9 @@ const PhotoSharing = ( ): Node => { const newObservation = await Observation.createObservationWithPhotos( photoUris ); newObservation.description = sharedText; prepareObsEdit( newObservation ); - if ( isAdvancedSuggestionsMode ) { + if ( isDefaultMode ) { + navigation.navigate( "NoBottomTabStackNavigator", { screen: "Match" } ); + } else if ( isAdvancedSuggestionsMode ) { navigation.navigate( "NoBottomTabStackNavigator", { screen: "Suggestions", params: { lastScreen: "PhotoSharing" } } @@ -43,7 +46,8 @@ const PhotoSharing = ( ): Node => { navigation, prepareObsEdit, sharedText, - isAdvancedSuggestionsMode + isAdvancedSuggestionsMode, + isDefaultMode ] ); useEffect( ( ) => {