# All files / atlas/src/components LandmarkPin.tsx

33.33% Statements 1/3
0% Branches 0/2
0% Functions 0/2
33.33% Lines 1/3

Press n or j to go to the next uncovered block, b, p or k for the previous block.

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33

    4x

     import React, { memo } from "react";
    import { Image } from "react-native";
    import { Marker } from "react-native-maps";
    import { Icons } from "../globals";
    import { Landmark } from "../hooks/useLandmarks";

    /**
     * Props for the {@link LandmarkPin} component
     */
    export interface LandmarkPinProps {
        /**The landmark object being displayed. */
        landmark: Landmark
        /**The handler passed down from {@link Map} that opens up the {@link LandmarkDetails} modal to display the landmark's properties. */
        focusLandmark: (landmark: Landmark) => void
    }

    /**
     * Component that renders landmarks with their proper icon on the {@link Map}.
     * @category Map
     * @component
     */
    const LandmarkPin: React.FC<LandmarkPinProps> = ({landmark, focusLandmark}) => {
        return (
        <Marker
            tracksViewChanges={false}
            onPress={() => focusLandmark(landmark)}
            key={landmark.id}
            coordinate={{latitude: landmark.latitude as number, longitude: landmark.longitude as number}} >
            { landmark.landmark_type ? <Image style={{height: 35, width: 25}} source={Icons[landmark.landmark_type]} /> : null}
        </Marker> )
    }

    export default memo(LandmarkPin);