-
-
Notifications
You must be signed in to change notification settings - Fork 937
Expand file tree
/
Copy pathBugReportExampleTS.tsx
More file actions
89 lines (83 loc) · 1.91 KB
/
BugReportExampleTS.tsx
File metadata and controls
89 lines (83 loc) · 1.91 KB
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
77
78
79
80
81
82
83
84
85
86
87
88
89
import { useState } from 'react';
import {
Camera,
CircleLayer,
Images,
MapView,
ShapeSource,
SymbolLayer,
} from '@rnmapbox/maps';
import { type FeatureCollection } from 'geojson';
import { Button } from 'react-native';
const styles = {
mapView: { flex: 1 },
circleLayer: {
circleRadiusTransition: { duration: 5000, delay: 0 },
circleColor: '#ff0000',
},
};
const features: FeatureCollection = {
type: 'FeatureCollection',
features: [
{
type: 'Feature',
id: 'a-feature',
properties: {
icon: 'example',
text: 'example-icon-and-label',
},
geometry: {
type: 'Point',
coordinates: [-74.00597, 40.71427],
},
},
{
type: 'Feature',
id: 'b-feature',
properties: {
text: 'just-label',
},
geometry: {
type: 'Point',
coordinates: [-74.001097, 40.71527],
},
},
{
type: 'Feature',
id: 'c-feature',
properties: {
icon: 'example',
},
geometry: {
type: 'Point',
coordinates: [-74.00697, 40.72427],
},
},
],
};
const BugReportExample = () => {
const [radius, setRadius] = useState(20);
const circleLayerStyle = {
...styles.circleLayer,
...{ circleRadius: radius },
};
return (
<>
<Button title="Grow" onPress={() => setRadius(radius + 20)} />
<MapView style={styles.mapView}>
<Camera centerCoordinate={[-74.00597, 40.71427]} zoomLevel={14} />
<Images images={{ example: require('../assets/example.png') }} />
<ShapeSource id={'shape-source-id-0'} shape={features}>
<CircleLayer id={'circle-layer'} style={circleLayerStyle} />
<SymbolLayer
id="symbol-id"
style={{
iconImage: ['get', 'icon'],
}}
/>
</ShapeSource>
</MapView>
</>
);
};
export default BugReportExample;