-
Notifications
You must be signed in to change notification settings - Fork 0
/
MarkerView.js
42 lines (40 loc) · 1.38 KB
/
MarkerView.js
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
41
42
import React, { useState } from "react";
import {View, Text, TouchableOpacity, Alert, LogBox} from 'react-native';
import Mapbox from '@rnmapbox/maps';
//id = {`${data[0].placeId}`}
// import POIDetail from "./POIDetail";
const MarkerView = ({data, callBack}) => {
const [selectM, setSelectM] = useState(false);
if(data != null) {
return(
<Mapbox.PointAnnotation
coordinate={[Number(data[0].centroid.lon), Number(data[0].centroid.lat)]}
anchor={{x: 0, y: 0.5}}
title={`${data[0].name}`}
id="point_anon"
ref={ref => (this.markerRef = ref)}
onSelected = { e => {
// console.log("selected");
callBack(data[0]);
setSelectM(true);
}}
>
<View style={{
height: 30,
width: 30,
backgroundColor: '#00cccc',
borderRadius: 50,
borderColor: '#fff',
borderWidth: 3
}} onLoad={() => this.markerRef.refresh()}/>
{/* {setSelectM ? POIDetail( data[0]) : null} */}
{/* <Mapbox.Callout
title={`${data[0].name}`}
style={{color: 'black'}}
/> */}
{/* <AnnotationContent title={ data[0].name}/> */}
</Mapbox.PointAnnotation>
)
}
}
export default MarkerView;