react-native-maps 0.31.1 → 1.0.0-beta.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (68) hide show
  1. package/README.md +1 -5
  2. package/android/src/main/AndroidManifest.xml +0 -3
  3. package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTile.java +11 -4
  4. package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTileManager.java +5 -1
  5. package/android/src/main/java/com/airbnb/android/react/maps/AirMapManager.java +2 -41
  6. package/android/src/main/java/com/airbnb/android/react/maps/AirMapTileProvider.java +5 -5
  7. package/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +0 -32
  8. package/ios/AirGoogleMaps/AIRGoogleMap.m +37 -31
  9. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -95
  10. package/ios/AirMaps/AIRMap.m +0 -7
  11. package/ios/AirMaps/AIRMapManager.m +0 -105
  12. package/lib/AnimatedRegion.d.ts +19 -0
  13. package/lib/AnimatedRegion.js +134 -0
  14. package/lib/Geojson.d.ts +166 -0
  15. package/lib/Geojson.js +165 -0
  16. package/lib/MapCallout.d.ts +40 -0
  17. package/lib/MapCallout.js +51 -0
  18. package/lib/MapCalloutSubview.d.ts +34 -0
  19. package/lib/MapCalloutSubview.js +48 -0
  20. package/lib/MapCircle.d.ts +117 -0
  21. package/lib/MapCircle.js +53 -0
  22. package/lib/MapHeatmap.d.ts +77 -0
  23. package/lib/MapHeatmap.js +59 -0
  24. package/lib/MapLocalTile.d.ts +35 -0
  25. package/lib/MapLocalTile.js +44 -0
  26. package/lib/MapMarker.d.ts +289 -0
  27. package/lib/MapMarker.js +113 -0
  28. package/lib/MapOverlay.d.ts +86 -0
  29. package/lib/MapOverlay.js +63 -0
  30. package/lib/MapPolygon.d.ts +156 -0
  31. package/lib/MapPolygon.js +74 -0
  32. package/lib/MapPolyline.d.ts +156 -0
  33. package/lib/MapPolyline.js +53 -0
  34. package/lib/MapUrlTile.d.ts +134 -0
  35. package/lib/MapUrlTile.js +44 -0
  36. package/lib/MapView.d.ts +825 -0
  37. package/lib/MapView.js +418 -0
  38. package/{src/MapView.web.js → lib/MapView.web.d.ts} +0 -0
  39. package/lib/MapView.web.js +9 -0
  40. package/lib/MapWMSTile.d.ts +116 -0
  41. package/lib/MapWMSTile.js +44 -0
  42. package/lib/ProviderConstants.d.ts +2 -0
  43. package/lib/ProviderConstants.js +5 -0
  44. package/lib/decorateMapComponent.d.ts +35 -0
  45. package/lib/decorateMapComponent.js +80 -0
  46. package/{src/index.js → lib/index.d.ts} +5 -16
  47. package/lib/index.js +66 -0
  48. package/lib/sharedTypes.d.ts +82 -0
  49. package/lib/sharedTypes.js +2 -0
  50. package/package.json +18 -27
  51. package/react-native-google-maps.podspec +1 -1
  52. package/index.d.ts +0 -637
  53. package/src/AnimatedRegion.js +0 -164
  54. package/src/Geojson.js +0 -334
  55. package/src/MapCallout.js +0 -51
  56. package/src/MapCalloutSubview.js +0 -44
  57. package/src/MapCircle.js +0 -150
  58. package/src/MapHeatmap.js +0 -99
  59. package/src/MapLocalTile.js +0 -52
  60. package/src/MapMarker.js +0 -377
  61. package/src/MapOverlay.js +0 -86
  62. package/src/MapPolygon.js +0 -202
  63. package/src/MapPolyline.js +0 -168
  64. package/src/MapUrlTile.js +0 -131
  65. package/src/MapView.js +0 -1160
  66. package/src/MapWMSTile.js +0 -122
  67. package/src/ProviderConstants.js +0 -2
  68. package/src/decorateMapComponent.js +0 -112
@@ -0,0 +1,113 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MapMarker = void 0;
27
+ const React = __importStar(require("react"));
28
+ const react_native_1 = require("react-native");
29
+ const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
+ class MapMarker extends React.Component {
31
+ getNativeComponent;
32
+ getMapManagerCommand;
33
+ getUIManagerCommand;
34
+ static Animated;
35
+ marker;
36
+ constructor(props) {
37
+ super(props);
38
+ this.marker = React.createRef();
39
+ this.showCallout = this.showCallout.bind(this);
40
+ this.hideCallout = this.hideCallout.bind(this);
41
+ this.redrawCallout = this.redrawCallout.bind(this);
42
+ this.animateMarkerToCoordinate = this.animateMarkerToCoordinate.bind(this);
43
+ }
44
+ setNativeProps(props) {
45
+ this.marker.current?.setNativeProps(props);
46
+ }
47
+ showCallout() {
48
+ this._runCommand('showCallout', []);
49
+ }
50
+ hideCallout() {
51
+ this._runCommand('hideCallout', []);
52
+ }
53
+ redrawCallout() {
54
+ this._runCommand('redrawCallout', []);
55
+ }
56
+ animateMarkerToCoordinate(coordinate, duration = 500) {
57
+ this._runCommand('animateMarkerToCoordinate', [coordinate, duration]);
58
+ }
59
+ redraw() {
60
+ this._runCommand('redraw', []);
61
+ }
62
+ _getHandle() {
63
+ return (0, react_native_1.findNodeHandle)(this.marker.current);
64
+ }
65
+ _runCommand(name, args) {
66
+ switch (react_native_1.Platform.OS) {
67
+ case 'android':
68
+ react_native_1.UIManager.dispatchViewManagerCommand(this._getHandle(), this.getUIManagerCommand(name), args);
69
+ break;
70
+ case 'ios':
71
+ this.getMapManagerCommand(name)(this._getHandle(), ...args);
72
+ break;
73
+ default:
74
+ break;
75
+ }
76
+ }
77
+ render() {
78
+ const { stopPropagation = false } = this.props;
79
+ let image;
80
+ if (this.props.image) {
81
+ image = react_native_1.Image.resolveAssetSource(this.props.image) || {};
82
+ image = image.uri || this.props.image;
83
+ }
84
+ let icon;
85
+ if (this.props.icon) {
86
+ icon = react_native_1.Image.resolveAssetSource(this.props.icon) || {};
87
+ icon = icon.uri;
88
+ }
89
+ const AIRMapMarker = this.getNativeComponent();
90
+ return (<AIRMapMarker {...this.props} ref={this.marker} image={image} icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
91
+ if (stopPropagation) {
92
+ event.stopPropagation();
93
+ }
94
+ if (this.props.onPress) {
95
+ this.props.onPress(event);
96
+ }
97
+ }}/>);
98
+ }
99
+ }
100
+ exports.MapMarker = MapMarker;
101
+ const styles = react_native_1.StyleSheet.create({
102
+ marker: {
103
+ position: 'absolute',
104
+ backgroundColor: 'transparent',
105
+ },
106
+ });
107
+ MapMarker.Animated = react_native_1.Animated.createAnimatedComponent(MapMarker);
108
+ exports.default = (0, decorateMapComponent_1.default)(MapMarker, 'Marker', {
109
+ google: {
110
+ ios: decorateMapComponent_1.SUPPORTED,
111
+ android: decorateMapComponent_1.USES_DEFAULT_IMPLEMENTATION,
112
+ },
113
+ });
@@ -0,0 +1,86 @@
1
+ import * as React from 'react';
2
+ import { Animated, ViewProps, ImageURISource, ImageRequireSource, NativeSyntheticEvent } from 'react-native';
3
+ import { MapManagerCommand, NativeComponent, ProviderContext, UIManagerCommand } from './decorateMapComponent';
4
+ import { LatLng, Modify, Point } from './sharedTypes';
5
+ declare type Props = ViewProps & {
6
+ /**
7
+ * The bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
8
+ *
9
+ * @default 0
10
+ * @platform iOS: Google Maps only
11
+ * @platform Android: Supported
12
+ */
13
+ bearing?: number;
14
+ /**
15
+ * The coordinates for the image (left-top corner, right-bottom corner). ie.```[[lat, long], [lat, long]]```
16
+ *
17
+ * @platform iOS: Supported
18
+ * @platform Android: Supported
19
+ */
20
+ bounds: [Coordinate, Coordinate];
21
+ /**
22
+ * A custom image to be used as the overlay.
23
+ * Only required local image resources and uri (as for images located in the net) are allowed to be used.
24
+ *
25
+ * @platform iOS: Supported
26
+ * @platform Android: Supported
27
+ */
28
+ image: ImageURISource | ImageRequireSource;
29
+ /**
30
+ * Callback that is called when the user presses on the overlay
31
+ *
32
+ * @platform iOS: Apple Maps only
33
+ * @platform Android: Supported
34
+ */
35
+ onPress?: (event: OverlayPressEvent) => void;
36
+ /**
37
+ * The opacity of the overlay.
38
+ *
39
+ * @default 1
40
+ * @platform iOS: Google Maps only
41
+ * @platform Android: Supported
42
+ */
43
+ opacity?: number;
44
+ /**
45
+ * Boolean to allow an overlay to be tappable and use the onPress function.
46
+ *
47
+ * @default false
48
+ * @platform iOS: Not supported
49
+ * @platform Android: Supported
50
+ */
51
+ tappable?: boolean;
52
+ };
53
+ declare type NativeProps = Modify<Props, {
54
+ image?: string;
55
+ }>;
56
+ export declare class MapOverlay extends React.Component<Props> {
57
+ context: React.ContextType<typeof ProviderContext>;
58
+ getNativeComponent: () => NativeComponent<NativeProps>;
59
+ getMapManagerCommand: (name: string) => MapManagerCommand;
60
+ getUIManagerCommand: (name: string) => UIManagerCommand;
61
+ static Animated: Animated.AnimatedComponent<typeof MapOverlay>;
62
+ render(): JSX.Element;
63
+ }
64
+ declare type Coordinate = [number, number];
65
+ declare type OverlayPressEvent = NativeSyntheticEvent<{
66
+ /**
67
+ * @platform iOS: Apple Maps: `image-overlay-press`
68
+ * @platform Android: `overlay-press`
69
+ */
70
+ action: 'overlay-press' | 'image-overlay-press';
71
+ /**
72
+ * @platform iOS: Apple maps
73
+ */
74
+ name?: string;
75
+ /**
76
+ * @platform iOS: Apple Maps
77
+ * @platform Android
78
+ */
79
+ coordinate?: LatLng;
80
+ /**
81
+ * @platform Android
82
+ */
83
+ position?: Point;
84
+ }>;
85
+ declare const _default: typeof MapOverlay;
86
+ export default _default;
@@ -0,0 +1,63 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MapOverlay = void 0;
27
+ const React = __importStar(require("react"));
28
+ const react_native_1 = require("react-native");
29
+ const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
+ class MapOverlay extends React.Component {
31
+ getNativeComponent;
32
+ getMapManagerCommand;
33
+ getUIManagerCommand;
34
+ static Animated;
35
+ render() {
36
+ const { opacity = 1.0 } = this.props;
37
+ let image;
38
+ if (typeof this.props.image !== 'number' &&
39
+ this.props.image.uri?.startsWith('http')) {
40
+ image = this.props.image.uri;
41
+ }
42
+ else {
43
+ const sourceAsset = react_native_1.Image.resolveAssetSource(this.props.image) || {};
44
+ image = sourceAsset.uri;
45
+ }
46
+ const AIRMapOverlay = this.getNativeComponent();
47
+ return (<AIRMapOverlay {...this.props} opacity={opacity} image={image} style={[styles.overlay, this.props.style]}/>);
48
+ }
49
+ }
50
+ exports.MapOverlay = MapOverlay;
51
+ const styles = react_native_1.StyleSheet.create({
52
+ overlay: {
53
+ position: 'absolute',
54
+ backgroundColor: 'transparent',
55
+ },
56
+ });
57
+ MapOverlay.Animated = react_native_1.Animated.createAnimatedComponent(MapOverlay);
58
+ exports.default = (0, decorateMapComponent_1.default)(MapOverlay, 'Overlay', {
59
+ google: {
60
+ ios: decorateMapComponent_1.SUPPORTED,
61
+ android: decorateMapComponent_1.USES_DEFAULT_IMPLEMENTATION,
62
+ },
63
+ });
@@ -0,0 +1,156 @@
1
+ import * as React from 'react';
2
+ import { NativeSyntheticEvent, View, ViewProps } from 'react-native';
3
+ import { ProviderContext, NativeComponent, MapManagerCommand, UIManagerCommand } from './decorateMapComponent';
4
+ import { LatLng, LineCapType, LineJoinType, Point } from './sharedTypes';
5
+ export declare type Props = ViewProps & {
6
+ /**
7
+ * An array of coordinates to describe the polygon
8
+ *
9
+ * @platform iOS: Supported
10
+ * @platform Android: Supported
11
+ */
12
+ coordinates: LatLng[];
13
+ /**
14
+ * The fill color to use for the path.
15
+ *
16
+ * @default `#000`, `rgba(r,g,b,0.5)`
17
+ * @platform iOS: Supported
18
+ * @platform Android: Supported
19
+ */
20
+ fillColor?: string;
21
+ /**
22
+ * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to straight lines on the Mercator projection.
23
+ * A geodesic is the shortest path between two points on the Earth's surface.
24
+ * The geodesic curve is constructed assuming the Earth is a sphere.
25
+ *
26
+ * @platform iOS: Google Maps only
27
+ * @platform Android: Supported
28
+ */
29
+ geodesic?: boolean;
30
+ /**
31
+ * A 2d array of coordinates to describe holes of the polygon where each hole has at least 3 points.
32
+ *
33
+ * @platform iOS: Supported
34
+ * @platform Android: Supported
35
+ */
36
+ holes?: LatLng[][];
37
+ /**
38
+ * The line cap style to apply to the open ends of the path
39
+ *
40
+ * @default `round`
41
+ * @platform iOS: Apple Maps only
42
+ * @platform Android: Not supported
43
+ */
44
+ lineCap?: LineCapType;
45
+ /**
46
+ * An array of numbers specifying the dash pattern to use for the path.
47
+ * The array contains one or more numbers that indicate the lengths (measured in points)
48
+ * of the line segments and gaps in the pattern.
49
+ * The values in the array alternate, starting with the first line segment length,
50
+ * followed by the first gap length, followed by the second line segment length, and so on.
51
+ *
52
+ * @platform iOS: Apple Maps only
53
+ * @platform Android: Not supported
54
+ */
55
+ lineDashPattern?: number[];
56
+ /**
57
+ * The offset (in points) at which to start drawing the dash pattern.
58
+ * Use this property to start drawing a dashed line partway through a segment or gap.
59
+ * For example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the middle of the first gap.
60
+ *
61
+ * @default 0
62
+ * @platform iOS: Apple Maps only
63
+ * @platform Android: Not supported
64
+ */
65
+ lineDashPhase?: number;
66
+ /**
67
+ * The line join style to apply to corners of the path.
68
+ *
69
+ * @platform iOS: Apple Maps only
70
+ * @platform Android: Not supported
71
+ */
72
+ lineJoin?: LineJoinType;
73
+ /**
74
+ * The limiting value that helps avoid spikes at junctions between connected line segments.
75
+ * The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style.
76
+ * If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit,
77
+ * the joint is converted to a bevel join.
78
+ * The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees.
79
+ *
80
+ * @default 10
81
+ * @platform iOS: Apple Maps only
82
+ * @platform Android: Not supported
83
+ */
84
+ miterLimit?: number;
85
+ /**
86
+ * Callback that is called when the user presses on the polygon
87
+ *
88
+ * @platform iOS: Supported
89
+ * @platform Android: Supported
90
+ */
91
+ onPress?: (event: PolygonPressEvent) => void;
92
+ /**
93
+ * The stroke color to use for the path.
94
+ *
95
+ * @default `#000`, `rgba(r,g,b,0.5)`
96
+ * @platform iOS: Supported
97
+ * @platform Android: Supported
98
+ */
99
+ strokeColor?: string;
100
+ /**
101
+ * The stroke width to use for the path.
102
+ *
103
+ * @default 1
104
+ * @platform iOS: Supported
105
+ * @platform Android: Supported
106
+ */
107
+ strokeWidth?: number;
108
+ /**
109
+ * Boolean to allow a polygon to be tappable and use the onPress function.
110
+ *
111
+ * @platform iOS: Google Maps only
112
+ * @platform Android: Supported
113
+ */
114
+ tappable?: boolean;
115
+ /**
116
+ * The order in which this tile overlay is drawn with respect to other overlays.
117
+ * An overlay with a larger z-index is drawn over overlays with smaller z-indices.
118
+ * The order of overlays with the same z-index is arbitrary.
119
+ *
120
+ * @platform iOS: Google Maps only
121
+ * @platform Android: Supported
122
+ */
123
+ zIndex?: number;
124
+ };
125
+ declare type NativeProps = Props & {
126
+ ref: React.RefObject<View>;
127
+ };
128
+ export declare class MapPolygon extends React.Component<Props> {
129
+ context: React.ContextType<typeof ProviderContext>;
130
+ getNativeComponent: () => NativeComponent<NativeProps>;
131
+ getMapManagerCommand: (name: string) => MapManagerCommand;
132
+ getUIManagerCommand: (name: string) => UIManagerCommand;
133
+ private polygon;
134
+ constructor(props: Props);
135
+ setNativeProps(props: Partial<Props>): void;
136
+ updateNativeProps(): () => void;
137
+ render(): JSX.Element;
138
+ }
139
+ declare const _default: typeof MapPolygon;
140
+ export default _default;
141
+ declare type PolygonPressEvent = NativeSyntheticEvent<{
142
+ action: 'polygon-press';
143
+ /**
144
+ * @platform iOS: Google Maps
145
+ */
146
+ id?: string;
147
+ /**
148
+ * @platform iOS: Apple Maps
149
+ * @platform Android
150
+ */
151
+ coordinate?: LatLng;
152
+ /**
153
+ * @platform Android
154
+ */
155
+ position?: Point;
156
+ }>;
@@ -0,0 +1,74 @@
1
+ "use strict";
2
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
+ if (k2 === undefined) k2 = k;
4
+ var desc = Object.getOwnPropertyDescriptor(m, k);
5
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
+ desc = { enumerable: true, get: function() { return m[k]; } };
7
+ }
8
+ Object.defineProperty(o, k2, desc);
9
+ }) : (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ o[k2] = m[k];
12
+ }));
13
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
15
+ }) : function(o, v) {
16
+ o["default"] = v;
17
+ });
18
+ var __importStar = (this && this.__importStar) || function (mod) {
19
+ if (mod && mod.__esModule) return mod;
20
+ var result = {};
21
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
+ __setModuleDefault(result, mod);
23
+ return result;
24
+ };
25
+ Object.defineProperty(exports, "__esModule", { value: true });
26
+ exports.MapPolygon = void 0;
27
+ const React = __importStar(require("react"));
28
+ const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
29
+ const ProviderConstants = __importStar(require("./ProviderConstants"));
30
+ class MapPolygon extends React.Component {
31
+ getNativeComponent;
32
+ getMapManagerCommand;
33
+ getUIManagerCommand;
34
+ polygon;
35
+ constructor(props) {
36
+ super(props);
37
+ this.polygon = React.createRef();
38
+ }
39
+ setNativeProps(props) {
40
+ this.polygon.current?.setNativeProps(props);
41
+ }
42
+ updateNativeProps() {
43
+ return () => {
44
+ const { fillColor, strokeColor, strokeWidth } = this.props;
45
+ let polygonNativeProps = {};
46
+ if (fillColor) {
47
+ polygonNativeProps.fillColor = fillColor;
48
+ }
49
+ if (strokeColor) {
50
+ polygonNativeProps.strokeColor = strokeColor;
51
+ }
52
+ if (strokeWidth) {
53
+ polygonNativeProps.strokeWidth = strokeWidth;
54
+ }
55
+ if (polygonNativeProps) {
56
+ this.setNativeProps(polygonNativeProps);
57
+ }
58
+ };
59
+ }
60
+ render() {
61
+ const { strokeColor = '#000', strokeWidth = 1 } = this.props;
62
+ const AIRMapPolygon = this.getNativeComponent();
63
+ return (<AIRMapPolygon {...this.props} strokeColor={strokeColor} strokeWidth={strokeWidth} ref={this.polygon} onLayout={this.context === ProviderConstants.PROVIDER_GOOGLE
64
+ ? this.updateNativeProps()
65
+ : undefined}/>);
66
+ }
67
+ }
68
+ exports.MapPolygon = MapPolygon;
69
+ exports.default = (0, decorateMapComponent_1.default)(MapPolygon, 'Polygon', {
70
+ google: {
71
+ ios: decorateMapComponent_1.SUPPORTED,
72
+ android: decorateMapComponent_1.USES_DEFAULT_IMPLEMENTATION,
73
+ },
74
+ });
@@ -0,0 +1,156 @@
1
+ import * as React from 'react';
2
+ import { NativeSyntheticEvent, View, ViewProps } from 'react-native';
3
+ import { ProviderContext, NativeComponent, MapManagerCommand, UIManagerCommand } from './decorateMapComponent';
4
+ import { LatLng, LineCapType, LineJoinType, Point } from './sharedTypes';
5
+ export declare type Props = ViewProps & {
6
+ /**
7
+ * An array of coordinates to describe the polyline
8
+ *
9
+ * @platform iOS: Supported
10
+ * @platform Android: Supported
11
+ */
12
+ coordinates: LatLng[];
13
+ /**
14
+ * The fill color to use for the path.
15
+ *
16
+ * @default `#000`, `rgba(r,g,b,0.5)`
17
+ * @platform iOS: Supported
18
+ * @platform Android: Not supported
19
+ */
20
+ fillColor?: string;
21
+ /**
22
+ * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to straight lines on the Mercator projection.
23
+ * A geodesic is the shortest path between two points on the Earth's surface.
24
+ * The geodesic curve is constructed assuming the Earth is a sphere.
25
+ *
26
+ * @platform iOS: Google Maps only
27
+ * @platform Android: Supported
28
+ */
29
+ geodesic?: boolean;
30
+ /**
31
+ * The line cap style to apply to the open ends of the path
32
+ *
33
+ * @default `round`
34
+ * @platform iOS: Apple Maps only
35
+ * @platform Android: Supported
36
+ */
37
+ lineCap?: LineCapType;
38
+ /**
39
+ * An array of numbers specifying the dash pattern to use for the path.
40
+ * The array contains one or more numbers that indicate the lengths (measured in points)
41
+ * of the line segments and gaps in the pattern.
42
+ * The values in the array alternate, starting with the first line segment length,
43
+ * followed by the first gap length, followed by the second line segment length, and so on.
44
+ *
45
+ * @platform iOS: Supported
46
+ * @platform Android: Supported
47
+ */
48
+ lineDashPattern?: number[];
49
+ /**
50
+ * The offset (in points) at which to start drawing the dash pattern.
51
+ * Use this property to start drawing a dashed line partway through a segment or gap.
52
+ * For example, a phase value of 6 for the patter 5-2-3-2 would cause drawing to begin in the middle of the first gap.
53
+ *
54
+ * @default 0
55
+ * @platform iOS: Apple Maps only
56
+ * @platform Android: Not supported
57
+ */
58
+ lineDashPhase?: number;
59
+ /**
60
+ * The line join style to apply to corners of the path.
61
+ *
62
+ * @platform iOS: Apple Maps only
63
+ * @platform Android: Not supported
64
+ */
65
+ lineJoin?: LineJoinType;
66
+ /**
67
+ * The limiting value that helps avoid spikes at junctions between connected line segments.
68
+ * The miter limit helps you avoid spikes in paths that use the `miter` `lineJoin` style.
69
+ * If the ratio of the miter length—that is, the diagonal length of the miter join—to the line thickness exceeds the miter limit,
70
+ * the joint is converted to a bevel join.
71
+ * The default miter limit is 10, which results in the conversion of miters whose angle at the joint is less than 11 degrees.
72
+ *
73
+ * @default 10
74
+ * @platform iOS: Apple Maps only
75
+ * @platform Android: Not supported
76
+ */
77
+ miterLimit?: number;
78
+ /**
79
+ * Callback that is called when the user presses on the polyline
80
+ *
81
+ * @platform iOS: Supported
82
+ * @platform Android: Supported
83
+ */
84
+ onPress?: (event: PolylinePressEvent) => void;
85
+ /**
86
+ * The stroke color to use for the path.
87
+ *
88
+ * @default `#000`, `rgba(r,g,b,0.5)`
89
+ * @platform iOS: Supported
90
+ * @platform Android: Supported
91
+ */
92
+ strokeColor?: string;
93
+ /**
94
+ * The stroke colors to use for the path.
95
+ *
96
+ * Must be the same length as `coordinates`
97
+ *
98
+ * @platform iOS: Supported
99
+ * @platform Android: Supported
100
+ */
101
+ strokeColors?: string[];
102
+ /**
103
+ * The stroke width to use for the path.
104
+ *
105
+ * @default 1
106
+ * @platform iOS: Supported
107
+ * @platform Android: Supported
108
+ */
109
+ strokeWidth?: number;
110
+ /**
111
+ * Boolean to allow the polyline to be tappable and use the onPress function.
112
+ *
113
+ * @platform iOS: Google Maps only
114
+ * @platform Android: Supported
115
+ */
116
+ tappable?: boolean;
117
+ /**
118
+ * The order in which this tile overlay is drawn with respect to other overlays.
119
+ * An overlay with a larger z-index is drawn over overlays with smaller z-indices.
120
+ * The order of overlays with the same z-index is arbitrary.
121
+ *
122
+ * @platform iOS: Google Maps only
123
+ * @platform Android: Supported
124
+ */
125
+ zIndex?: number;
126
+ };
127
+ declare type NativeProps = Props & {
128
+ ref: React.RefObject<View>;
129
+ };
130
+ export declare class MapPolyline extends React.Component<Props> {
131
+ context: React.ContextType<typeof ProviderContext>;
132
+ getNativeComponent: () => NativeComponent<NativeProps>;
133
+ getMapManagerCommand: (name: string) => MapManagerCommand;
134
+ getUIManagerCommand: (name: string) => UIManagerCommand;
135
+ private polyline;
136
+ constructor(props: Props);
137
+ setNativeProps(props: Partial<NativeProps>): void;
138
+ render(): JSX.Element;
139
+ }
140
+ declare const _default: typeof MapPolyline;
141
+ export default _default;
142
+ declare type PolylinePressEvent = NativeSyntheticEvent<{
143
+ action: 'polyline-press';
144
+ /**
145
+ * @platform iOS: Google Maps
146
+ */
147
+ id?: string;
148
+ /**
149
+ * @platform Android
150
+ */
151
+ coordinate?: LatLng;
152
+ /**
153
+ * @platform Android
154
+ */
155
+ position?: Point;
156
+ }>;