mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
MOB-722 DRY match button type
This commit is contained in:
@@ -18,6 +18,7 @@ import AdditionalSuggestionsScroll
|
||||
from "./AdditionalSuggestions/AdditionalSuggestionsScroll";
|
||||
import EmptyMapSection from "./EmptyMapSection";
|
||||
import IconicSuggestionsScroll from "./IconicSuggestions/IconicSuggestionsScroll";
|
||||
import type { MatchButtonAction } from "./MatchContainer";
|
||||
import MatchHeader from "./MatchHeader";
|
||||
import PhotosSection from "./PhotosSection";
|
||||
import SaveDiscardButtons from "./SaveDiscardButtons";
|
||||
@@ -30,7 +31,7 @@ export const matchCardClassBottom
|
||||
type Props = {
|
||||
observation: RealmObservation,
|
||||
obsPhotos: RealmObservationPhoto[],
|
||||
handleSaveOrDiscardPress: ( action: string ) => void,
|
||||
handleSaveOrDiscardPress: ( action: MatchButtonAction ) => void,
|
||||
navToTaxonDetails: ( photo?: ApiPhoto ) => void,
|
||||
isFetchingLocation: boolean,
|
||||
handleAddLocationPressed: ( ) => void,
|
||||
|
||||
@@ -59,6 +59,8 @@ interface State {
|
||||
orderedSuggestions: ApiSuggestion[];
|
||||
}
|
||||
|
||||
export type MatchButtonAction = "save" | "discard";
|
||||
|
||||
type Action =
|
||||
| { type: "SET_UPLOAD_PARAMS"; scoreImageParams: ImageParamsType }
|
||||
| { type: "SET_ONLINE_FETCH_STATUS"; onlineFetchStatus: FETCH_STATUSES }
|
||||
@@ -497,7 +499,7 @@ const MatchContainer = ( ) => {
|
||||
navigation.push( "TaxonDetails", navParams );
|
||||
};
|
||||
|
||||
const handleSaveOrDiscardPress = async ( action: string ) => {
|
||||
const handleSaveOrDiscardPress = async ( action: MatchButtonAction ) => {
|
||||
if ( action === "save" ) {
|
||||
updateObservationKeys( {
|
||||
taxon: taxon || iconicTaxon,
|
||||
|
||||
@@ -6,13 +6,15 @@ import React from "react";
|
||||
import { useTranslation } from "sharedHooks";
|
||||
import { getShadow } from "styles/global";
|
||||
|
||||
import type { MatchButtonAction } from "./MatchContainer";
|
||||
|
||||
const DROP_SHADOW = getShadow( {
|
||||
offsetHeight: -3,
|
||||
shadowOpacity: 0.2
|
||||
} );
|
||||
|
||||
type Props = {
|
||||
handlePress: ( action: string ) => void
|
||||
handlePress: ( action: MatchButtonAction ) => void
|
||||
}
|
||||
|
||||
const SaveDiscardButtons = ( {
|
||||
|
||||
Reference in New Issue
Block a user