Sharing one photo routes to Match (#2768)

This commit is contained in:
Johannes Klein
2025-03-14 17:41:57 +01:00
committed by GitHub
parent acc878f94a
commit bbe02dd4c4

View File

@@ -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( ( ) => {