mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2026-05-24 08:22:26 -04:00
Sharing one photo routes to Match (#2768)
This commit is contained in:
@@ -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( ( ) => {
|
||||
|
||||
Reference in New Issue
Block a user