-
Notifications
You must be signed in to change notification settings - Fork 0
/
AddMarker.js
76 lines (72 loc) · 1.97 KB
/
AddMarker.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
import React from 'react';
import {StyleSheet, View, Image} from 'react-native';
import MapLibreGL from '@react-native-mapbox-gl/maps';
import {accessToken} from '../../config';
const styles = StyleSheet.create({
page: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#F5FCFF',
},
container: {
width: '100%',
height: '100%',
backgroundColor: 'white',
},
map: {
flex: 1,
},
});
const AddMarker = () => {
return (
<View style={styles.page}>
<View style={styles.container}>
<MapLibreGL.MapView
style={styles.map}
logoEnabled={false}
attributionEnabled={true}
attributionPosition={{bottom: 8, left: 8}}
styleURL={`https://api.jawg.io/styles/jawg-sunny.json?access-token=${accessToken}`}>
<MapLibreGL.Camera
defaultSettings={{
centerCoordinate: [2.3210938, 48.8565913],
zoomLevel: 5,
}}
/>
<MapLibreGL.MarkerView
coordinate={[-0.124589, 51.500741]}
children={
<Image
source={{
uri: 'https://www.r7.jawg.io/docs/images/icons/big-ben.png',
}}
style={{width: 25, height: 25}}
/>
}
anchor={{x: 0, y: 0.5}}
/>
<MapLibreGL.ShapeSource
id="marker-source"
shape={{
type: 'Feature',
geometry: {
type: 'Point',
coordinates: [2.294694, 48.858093],
},
}}>
<MapLibreGL.SymbolLayer
id="marker-layer"
style={{
iconImage:
'https://www.jawg.io/docs/images/icons/eiffel-tower.png',
iconSize: 0.5,
}}
/>
</MapLibreGL.ShapeSource>
</MapLibreGL.MapView>
</View>
</View>
);
};
export default AddMarker;