# All files / atlas-mobile-ts/src/components/Map LandmarkPin.tsx

0% Statements 0/8
0% Branches 0/2
0% Functions 0/2
0% Lines 0/8

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
    34
    35
    36
    37
    38
    39
    40

     ﻿/* Copyright (C) Click & Push Accessibility, Inc - All Rights Reserved
     * Unauthorized copying of this file, via any medium is strictly prohibited
     * Proprietary and confidential
     * Written and maintained by the Click & Push Development team
     * <dev@clicknpush.ca>, January 2022
     */

    import React from "react";
    import { Image } from "react-native";
    import { Marker } from "react-native-maps";
    import { lmTypes } from "../../utils/GlobalUtils";
    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={lmTypes[landmark.landmark_type].image} /> : null}
        </Marker> )
    }

    export default LandmarkPin;