|
@@ -0,0 +1,104 @@
|
|
1
|
+// @flow
|
|
2
|
+
|
|
3
|
+import * as React from 'react';
|
|
4
|
+import {View} from 'react-native';
|
|
5
|
+import {withTheme} from 'react-native-paper';
|
|
6
|
+import {StackNavigationProp} from "@react-navigation/stack";
|
|
7
|
+import type {CustomTheme} from "../../managers/ThemeManager";
|
|
8
|
+import MapboxGL from "@react-native-mapbox-gl/maps";
|
|
9
|
+
|
|
10
|
+type Props = {
|
|
11
|
+ navigation: StackNavigationProp,
|
|
12
|
+ theme: CustomTheme,
|
|
13
|
+}
|
|
14
|
+
|
|
15
|
+type State = {
|
|
16
|
+ featureCollection: Array<Object>,
|
|
17
|
+}
|
|
18
|
+
|
|
19
|
+MapboxGL.setAccessToken("pk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM2d5OHYwYmdiMndxdnV4bmh6bGFwIn0.qiOwbs2_HRaQGUOpBDjbsQ");
|
|
20
|
+
|
|
21
|
+// const styles = {
|
|
22
|
+// icon: {
|
|
23
|
+// iconImage: exampleIcon,
|
|
24
|
+// iconAllowOverlap: true,
|
|
25
|
+// },
|
|
26
|
+// };
|
|
27
|
+
|
|
28
|
+// const FEATURES = [{
|
|
29
|
+// type: 'Feature',
|
|
30
|
+// geometry: {
|
|
31
|
+// type: 'Point',
|
|
32
|
+// coordinates: [1.4669608, 43.5698867],
|
|
33
|
+// }
|
|
34
|
+// }]
|
|
35
|
+
|
|
36
|
+/**
|
|
37
|
+ * Class defining the app's map screen.
|
|
38
|
+ */
|
|
39
|
+class MapScreen extends React.Component<Props, State> {
|
|
40
|
+
|
|
41
|
+ map: { current: null | MapboxGL.MapView };
|
|
42
|
+
|
|
43
|
+ constructor() {
|
|
44
|
+ super();
|
|
45
|
+ this.map = React.createRef();
|
|
46
|
+
|
|
47
|
+ this.state = {
|
|
48
|
+ featureCollection: [],
|
|
49
|
+ };
|
|
50
|
+ }
|
|
51
|
+
|
|
52
|
+ componentDidMount() {
|
|
53
|
+ MapboxGL.setTelemetryEnabled(false);
|
|
54
|
+
|
|
55
|
+ }
|
|
56
|
+
|
|
57
|
+ // onSymbolPress = (feature) => {
|
|
58
|
+ // console.log("coucou");
|
|
59
|
+ // }
|
|
60
|
+ //
|
|
61
|
+ //
|
|
62
|
+ // onSourceLayerPress = ({features, coordinates, point}) => {
|
|
63
|
+ // console.log(
|
|
64
|
+ // 'You pressed a layer here are your features:',
|
|
65
|
+ // features,
|
|
66
|
+ // coordinates,
|
|
67
|
+ // point,
|
|
68
|
+ // );
|
|
69
|
+ // }
|
|
70
|
+
|
|
71
|
+ render() {
|
|
72
|
+ return (
|
|
73
|
+ <View style={{flex: 1}}>
|
|
74
|
+ <MapboxGL.MapView
|
|
75
|
+ style={{flex: 1}}
|
|
76
|
+ ref={this.map}
|
|
77
|
+ styleURL={MapboxGL.StyleURL.Outdoors}
|
|
78
|
+ surfaceView={true}
|
|
79
|
+ onPress={(e) => {
|
|
80
|
+ console.log(e)
|
|
81
|
+ }}
|
|
82
|
+ >
|
|
83
|
+ <MapboxGL.Camera
|
|
84
|
+ zoomLevel={15}
|
|
85
|
+ centerCoordinate={[1.4669608, 43.5698867]}
|
|
86
|
+ pitch={30}
|
|
87
|
+ />
|
|
88
|
+ {/*<MapboxGL.ShapeSource*/}
|
|
89
|
+ {/* id="symbolLocationSource"*/}
|
|
90
|
+ {/* shape={{ type: 'FeatureCollection', features: FEATURES }}*/}
|
|
91
|
+ {/*>*/}
|
|
92
|
+ {/* <MapboxGL.SymbolLayer*/}
|
|
93
|
+ {/* id="symbolLocationSymbols"*/}
|
|
94
|
+ {/* minZoomLevel={15}*/}
|
|
95
|
+ {/* style={styles.icon}*/}
|
|
96
|
+ {/* />*/}
|
|
97
|
+ {/*</MapboxGL.ShapeSource>*/}
|
|
98
|
+ </MapboxGL.MapView>
|
|
99
|
+ </View>
|
|
100
|
+ );
|
|
101
|
+ }
|
|
102
|
+}
|
|
103
|
+
|
|
104
|
+export default withTheme(MapScreen);
|