Skip to content

Commit

Permalink
navigate to observation in track observations list
Browse files Browse the repository at this point in the history
  • Loading branch information
CDFN committed Apr 23, 2024
1 parent 5a79ccf commit 2c566c3
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/frontend/screens/MapScreen/track/TrackObservations.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import ChevrondownDefault from '../../../images/chevrondown-expanded.svg';
import {TrackListItem} from './TrackListItem';
import {Observation} from '@mapeo/schema';
import {ObservationListItem} from '../../ObservationsList/ObservationListItem.tsx';
import {useNavigationFromHomeTabs} from '../../../hooks/useNavigationWithTypes.ts';

interface TrackObservation {
observations: Observation[];
Expand All @@ -21,7 +22,7 @@ interface TrackObservation {
export function TrackObservationList({observations}: TrackObservation) {
const [expanded, setExpanded] = useState(false);
const onPress = () => setExpanded(!expanded);

const navigation = useNavigationFromHomeTabs();
const Icon = expanded ? Chevrondown : ChevrondownDefault;

return (
Expand All @@ -43,7 +44,11 @@ export function TrackObservationList({observations}: TrackObservation) {
<ObservationListItem
key={index}
observation={observation}
onPress={() => {}}
onPress={() => {
navigation.navigate('Observation', {
observationId: observation.docId,
});
}}
testID={'id' + index}
/>
))}
Expand Down

0 comments on commit 2c566c3

Please sign in to comment.