|
@@ -0,0 +1,65 @@
|
|
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
|
+MapboxGL.setAccessToken("sk.eyJ1IjoiYW1pY2FsZS1pbnNhdCIsImEiOiJja2JpM212Z3QwYmxmMnhsc3RxZWYza2Q5In0.og84RKRa6-vr3qRA1qU9Aw");
|
|
16
|
+
|
|
17
|
+const layerStyles = {
|
|
18
|
+ smileyFace: {
|
|
19
|
+ fillAntialias: true,
|
|
20
|
+ fillColor: 'white',
|
|
21
|
+ fillOutlineColor: 'rgba(255, 255, 255, 0.84)',
|
|
22
|
+ },
|
|
23
|
+};
|
|
24
|
+
|
|
25
|
+/**
|
|
26
|
+ * Class defining the app's map screen.
|
|
27
|
+ */
|
|
28
|
+class MapScreen extends React.Component<Props> {
|
|
29
|
+
|
|
30
|
+ map : { current: null | MapboxGL.MapView };
|
|
31
|
+
|
|
32
|
+ constructor() {
|
|
33
|
+ super();
|
|
34
|
+ this.map = React.createRef();
|
|
35
|
+ }
|
|
36
|
+
|
|
37
|
+ componentDidMount() {
|
|
38
|
+ MapboxGL.setTelemetryEnabled(false);
|
|
39
|
+
|
|
40
|
+ }
|
|
41
|
+
|
|
42
|
+ render() {
|
|
43
|
+ return (
|
|
44
|
+ <View style={{flex: 1}}>
|
|
45
|
+ <MapboxGL.MapView
|
|
46
|
+ style={{flex: 1}}
|
|
47
|
+ styleURL={MapboxGL.StyleURL.Outdoors}
|
|
48
|
+ ref={this.map}
|
|
49
|
+ surfaceView={true}
|
|
50
|
+ onPress={async () => {
|
|
51
|
+ const center = await this.map.current.getCenter();
|
|
52
|
+ console.log(center);
|
|
53
|
+ }}
|
|
54
|
+ >
|
|
55
|
+ <MapboxGL.Camera
|
|
56
|
+ zoomLevel={15}
|
|
57
|
+ centerCoordinate={[1.4669608, 43.5698867]}
|
|
58
|
+ />
|
|
59
|
+ </MapboxGL.MapView>
|
|
60
|
+ </View>
|
|
61
|
+ );
|
|
62
|
+ }
|
|
63
|
+}
|
|
64
|
+
|
|
65
|
+export default withTheme(MapScreen);
|