forked from react-native-maps/react-native-maps
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMapPolygon.js
More file actions
135 lines (116 loc) · 3.17 KB
/
Copy pathMapPolygon.js
File metadata and controls
135 lines (116 loc) · 3.17 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
var React = require('react-native');
var {
View,
NativeMethodsMixin,
requireNativeComponent,
StyleSheet,
PropTypes,
} = React;
var MapPolygon = React.createClass({
mixins: [NativeMethodsMixin],
propTypes: {
...View.propTypes,
/**
* An array of coordinates to describe the polygon
*/
coordinates: PropTypes.arrayOf(PropTypes.shape({
/**
* Latitude/Longitude coordinates
*/
latitude: PropTypes.number.isRequired,
longitude: PropTypes.number.isRequired,
})),
/**
* Callback that is called when the user presses on the polygon
*/
onPress: PropTypes.func,
/**
* The stroke width to use for the path.
*/
strokeWidth: PropTypes.number,
/**
* The stroke color to use for the path.
*/
strokeColor: PropTypes.string,
/**
* The fill color to use for the path.
*/
fillColor: PropTypes.string,
/**
* The order in which this tile overlay is drawn with respect to other overlays. An overlay
* with a larger z-index is drawn over overlays with smaller z-indices. The order of overlays
* with the same z-index is arbitrary. The default zIndex is 0.
*
* @platform android
*/
zIndex: PropTypes.number,
/**
* The line cap style to apply to the open ends of the path.
* The default style is `round`.
*
* @platform ios
*/
lineCap: PropTypes.oneOf([
'butt',
'round',
'square',
]),
/**
* The line join style to apply to corners of the path.
* The default style is `round`.
*
* @platform ios
*/
lineJoin: PropTypes.oneOf([
'miter',
'round',
'bevel',
]),
/**
* The limiting value that helps avoid spikes at junctions between connected line segments.
* The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style. If
* the ratio of the miter length—that is, the diagonal length of the miter join—to the line
* thickness exceeds the miter limit, the joint is converted to a bevel join. The default
* miter limit is 10, which results in the conversion of miters whose angle at the joint
* is less than 11 degrees.
*
* @platform ios
*/
miterLimit: PropTypes.number,
/**
* Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to
* straight lines on the Mercator projection. A geodesic is the shortest path between two
* points on the Earth's surface. The geodesic curve is constructed assuming the Earth is
* a sphere.
*
* @platform android
*/
geodesic: PropTypes.bool,
},
getDefaultProps: function() {
return {
strokeColor: '#000',
strokeWidth: 1,
};
},
_onPress: function(e) {
this.props.onPress && this.props.onPress(e);
},
render: function() {
return (
<AIRMapPolygon
{...this.props}
onPress={this._onPress}
/>
);
},
});
var styles = StyleSheet.create({
polyline: {
position: 'absolute',
width: 0,
height: 0,
},
});
var AIRMapPolygon = requireNativeComponent('AIRMapPolygon', MapPolygon);
module.exports = MapPolygon;