mirror of
https://github.com/inaturalist/iNaturalistReactNative.git
synced 2025-12-23 22:18:36 -05:00
MOB-512 use observation as prop and rename testId
This commit is contained in:
@@ -5,30 +5,28 @@ import {
|
||||
import React, { useCallback, useEffect } from "react";
|
||||
import type { RealmObservation } from "realmModels/types";
|
||||
import {
|
||||
useLocalObservation,
|
||||
useNavigateToObsEdit,
|
||||
useTranslation
|
||||
} from "sharedHooks";
|
||||
import colors from "styles/tailwindColors";
|
||||
|
||||
interface Props {
|
||||
uuid: string;
|
||||
observation: RealmObservation;
|
||||
}
|
||||
|
||||
const SavedMatchHeaderRight = ( {
|
||||
uuid
|
||||
observation
|
||||
}: Props ) => {
|
||||
const navigation = useNavigation( );
|
||||
const { localObservation } = useLocalObservation( uuid );
|
||||
const { t } = useTranslation( );
|
||||
const navigateToObsEdit = useNavigateToObsEdit( );
|
||||
|
||||
const headerRight = useCallback(
|
||||
( ) => (
|
||||
<INatIconButton
|
||||
testID="ObsDetail.editButton"
|
||||
testID="SavedMatch.editButton"
|
||||
// TODO remove cast when useLocalObservation converted to typescript
|
||||
onPress={() => navigateToObsEdit( localObservation as RealmObservation )}
|
||||
onPress={() => navigateToObsEdit( observation )}
|
||||
icon="pencil"
|
||||
color={String( colors?.darkGray )}
|
||||
accessibilityLabel={t( "Edit" )}
|
||||
@@ -36,7 +34,7 @@ const SavedMatchHeaderRight = ( {
|
||||
/>
|
||||
),
|
||||
[
|
||||
localObservation,
|
||||
observation,
|
||||
navigateToObsEdit,
|
||||
t
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user