react-native-maps 0.31.1 → 1.0.0-beta.3
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.
- package/README.md +1 -5
- package/android/src/main/AndroidManifest.xml +0 -3
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTile.java +11 -4
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapLocalTileManager.java +5 -1
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapManager.java +2 -41
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapTileProvider.java +5 -5
- package/android/src/main/java/com/airbnb/android/react/maps/AirMapView.java +1 -33
- package/ios/AirGoogleMaps/AIRGoogleMap.m +37 -31
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -95
- package/ios/AirMaps/AIRMap.h +0 -1
- package/ios/AirMaps/AIRMap.m +0 -12
- package/ios/AirMaps/AIRMapManager.m +2 -132
- package/lib/AnimatedRegion.d.ts +19 -0
- package/lib/AnimatedRegion.js +134 -0
- package/lib/Geojson.d.ts +166 -0
- package/lib/Geojson.js +165 -0
- package/lib/MapCallout.d.ts +40 -0
- package/lib/MapCallout.js +51 -0
- package/lib/MapCalloutSubview.d.ts +34 -0
- package/lib/MapCalloutSubview.js +48 -0
- package/lib/MapCircle.d.ts +117 -0
- package/lib/MapCircle.js +53 -0
- package/lib/MapHeatmap.d.ts +77 -0
- package/lib/MapHeatmap.js +59 -0
- package/lib/MapLocalTile.d.ts +35 -0
- package/lib/MapLocalTile.js +44 -0
- package/lib/MapMarker.d.ts +289 -0
- package/lib/MapMarker.js +113 -0
- package/lib/MapOverlay.d.ts +86 -0
- package/lib/MapOverlay.js +63 -0
- package/lib/MapPolygon.d.ts +156 -0
- package/lib/MapPolygon.js +74 -0
- package/lib/MapPolyline.d.ts +156 -0
- package/lib/MapPolyline.js +53 -0
- package/lib/MapUrlTile.d.ts +134 -0
- package/lib/MapUrlTile.js +44 -0
- package/lib/MapView.d.ts +825 -0
- package/lib/MapView.js +418 -0
- package/{src/MapView.web.js → lib/MapView.web.d.ts} +0 -0
- package/lib/MapView.web.js +9 -0
- package/lib/MapWMSTile.d.ts +116 -0
- package/lib/MapWMSTile.js +44 -0
- package/lib/ProviderConstants.d.ts +2 -0
- package/lib/ProviderConstants.js +5 -0
- package/lib/decorateMapComponent.d.ts +35 -0
- package/lib/decorateMapComponent.js +80 -0
- package/{src/index.js → lib/index.d.ts} +5 -16
- package/lib/index.js +66 -0
- package/lib/sharedTypes.d.ts +82 -0
- package/lib/sharedTypes.js +2 -0
- package/package.json +19 -28
- package/react-native-google-maps.podspec +1 -1
- package/index.d.ts +0 -637
- package/src/AnimatedRegion.js +0 -164
- package/src/Geojson.js +0 -334
- package/src/MapCallout.js +0 -51
- package/src/MapCalloutSubview.js +0 -44
- package/src/MapCircle.js +0 -150
- package/src/MapHeatmap.js +0 -99
- package/src/MapLocalTile.js +0 -52
- package/src/MapMarker.js +0 -377
- package/src/MapOverlay.js +0 -86
- package/src/MapPolygon.js +0 -202
- package/src/MapPolyline.js +0 -168
- package/src/MapUrlTile.js +0 -131
- package/src/MapView.js +0 -1160
- package/src/MapWMSTile.js +0 -122
- package/src/ProviderConstants.js +0 -2
- package/src/decorateMapComponent.js +0 -112
|
@@ -0,0 +1,289 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Animated, ViewProps, ImageURISource, ImageRequireSource, View } from 'react-native';
|
|
3
|
+
import { MapManagerCommand, NativeComponent, ProviderContext, UIManagerCommand } from './decorateMapComponent';
|
|
4
|
+
import { CalloutPressEvent, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Modify, Point } from './sharedTypes';
|
|
5
|
+
export declare type Props = ViewProps & {
|
|
6
|
+
/**
|
|
7
|
+
* Sets the anchor point for the marker.
|
|
8
|
+
* The anchor specifies the point in the icon image that is anchored to the marker's position on the Earth's surface.
|
|
9
|
+
*
|
|
10
|
+
* The anchor point is specified in the continuous space [0.0, 1.0] x [0.0, 1.0],
|
|
11
|
+
* where (0, 0) is the top-left corner of the image, and (1, 1) is the bottom-right corner.
|
|
12
|
+
*
|
|
13
|
+
* The anchoring point in a W x H image is the nearest discrete grid point in a (W + 1) x (H + 1) grid, obtained by scaling the then rounding.
|
|
14
|
+
* For example, in a 4 x 2 image, the anchor point (0.7, 0.6) resolves to the grid point at (3, 1).
|
|
15
|
+
*
|
|
16
|
+
* @default {x: 0.5, y: 1.0}
|
|
17
|
+
* @platform iOS: Google Maps only. For Apple Maps, see the `centerOffset` prop
|
|
18
|
+
* @platform Android: Supported
|
|
19
|
+
*/
|
|
20
|
+
anchor?: Point;
|
|
21
|
+
/**
|
|
22
|
+
* Specifies the point in the marker image at which to anchor the callout when it is displayed.
|
|
23
|
+
* This is specified in the same coordinate system as the anchor.
|
|
24
|
+
*
|
|
25
|
+
* See the `anchor` prop for more details.
|
|
26
|
+
*
|
|
27
|
+
* @default {x: 0.5, y: 0.0}
|
|
28
|
+
* @platform iOS: Google Maps only. For Apple Maps, see the `calloutOffset` prop
|
|
29
|
+
* @platform Android: Supported
|
|
30
|
+
*/
|
|
31
|
+
calloutAnchor?: Point;
|
|
32
|
+
/**
|
|
33
|
+
* The offset (in points) at which to place the callout bubble.
|
|
34
|
+
* When this property is set to (0, 0),
|
|
35
|
+
* the anchor point of the callout bubble is placed on the top-center point of the marker view’s frame.
|
|
36
|
+
*
|
|
37
|
+
* Specifying positive offset values moves the callout bubble down and to the right,
|
|
38
|
+
* while specifying negative values moves it up and to the left
|
|
39
|
+
*
|
|
40
|
+
* @default {x: 0.0, y: 0.0}
|
|
41
|
+
* @platform iOS: Apple Maps only. For Google Maps, see the `calloutAnchor` prop
|
|
42
|
+
* @platform Android: Not supported. See see the `calloutAnchor` prop
|
|
43
|
+
*/
|
|
44
|
+
calloutOffset?: Point;
|
|
45
|
+
/**
|
|
46
|
+
* The offset (in points) at which to display the annotation view.
|
|
47
|
+
*
|
|
48
|
+
* By default, the center point of an annotation view is placed at the coordinate point of the associated annotation.
|
|
49
|
+
*
|
|
50
|
+
* Positive offset values move the annotation view down and to the right, while negative values move it up and to the left.
|
|
51
|
+
*
|
|
52
|
+
* @default {x: 0.0, y: 0.0}
|
|
53
|
+
* @platform iOS: Apple Maps only. For Google Maps, see the `anchor` prop
|
|
54
|
+
* @platform Android: Not supported. See see the `anchor` prop
|
|
55
|
+
*/
|
|
56
|
+
centerOffset?: Point;
|
|
57
|
+
/**
|
|
58
|
+
* The coordinate for the marker.
|
|
59
|
+
*
|
|
60
|
+
* @platform iOS: Supported
|
|
61
|
+
* @platform Android: Supported
|
|
62
|
+
*/
|
|
63
|
+
coordinate: LatLng;
|
|
64
|
+
/**
|
|
65
|
+
* The description of the marker.
|
|
66
|
+
*
|
|
67
|
+
* This is only used if the <Marker /> component has no children that are a `<Callout />`,
|
|
68
|
+
* in which case the default callout behavior will be used,
|
|
69
|
+
* which will show both the `title` and the `description`, if provided.
|
|
70
|
+
*
|
|
71
|
+
* @platform iOS: Supported
|
|
72
|
+
* @platform Android: Supported
|
|
73
|
+
*/
|
|
74
|
+
description?: string;
|
|
75
|
+
/**
|
|
76
|
+
* if `true` allows the marker to be draggable (re-positioned).
|
|
77
|
+
*
|
|
78
|
+
* @default false
|
|
79
|
+
* @platform iOS: Supported
|
|
80
|
+
* @platform Android: Supported
|
|
81
|
+
*/
|
|
82
|
+
draggable?: boolean;
|
|
83
|
+
/**
|
|
84
|
+
* Sets whether this marker should be flat against the map true or a billboard facing the camera.
|
|
85
|
+
*
|
|
86
|
+
* @default false
|
|
87
|
+
* @platform iOS: Google Maps only
|
|
88
|
+
* @platform Android: Supported
|
|
89
|
+
*/
|
|
90
|
+
flat?: boolean;
|
|
91
|
+
/**
|
|
92
|
+
* Marker icon to render (equivalent to `icon` property of GMSMarker Class).
|
|
93
|
+
* Only local image resources are allowed to be used.
|
|
94
|
+
*
|
|
95
|
+
* @platform iOS: Google Maps only
|
|
96
|
+
* @platform Android: Supported
|
|
97
|
+
*/
|
|
98
|
+
icon?: ImageURISource | ImageRequireSource;
|
|
99
|
+
/**
|
|
100
|
+
* A string that can be used to identify this marker.
|
|
101
|
+
*
|
|
102
|
+
* @platform iOS: Supported
|
|
103
|
+
* @platform Android: Supported
|
|
104
|
+
*/
|
|
105
|
+
identifier?: string;
|
|
106
|
+
/**
|
|
107
|
+
* A custom image to be used as the marker's icon. Only local image resources are allowed to be used.
|
|
108
|
+
*
|
|
109
|
+
* @platform iOS: Supported
|
|
110
|
+
* @platform Android: Supported
|
|
111
|
+
*/
|
|
112
|
+
image?: ImageURISource | ImageRequireSource;
|
|
113
|
+
/**
|
|
114
|
+
* When true, the marker will be pre-selected.
|
|
115
|
+
* Setting this to true allows the user to drag the marker without needing to tap on it first to focus it.
|
|
116
|
+
*
|
|
117
|
+
* @default false
|
|
118
|
+
* @platform iOS: Apple Maps only
|
|
119
|
+
* @platform Android: Not supported
|
|
120
|
+
*/
|
|
121
|
+
isPreselected?: boolean;
|
|
122
|
+
/**
|
|
123
|
+
* Callback that is called when the user taps the callout view.
|
|
124
|
+
*
|
|
125
|
+
* @platform iOS: Apple Maps only
|
|
126
|
+
* @platform Android: Supported
|
|
127
|
+
*/
|
|
128
|
+
onCalloutPress?: (event: CalloutPressEvent) => void;
|
|
129
|
+
/**
|
|
130
|
+
* Callback that is called when the marker is deselected, before the callout is hidden.
|
|
131
|
+
*
|
|
132
|
+
* @platform iOS: Apple Maps only
|
|
133
|
+
* @platform Android: Not supported
|
|
134
|
+
*/
|
|
135
|
+
onDeselect?: (event: MarkerDeselectEvent) => void;
|
|
136
|
+
/**
|
|
137
|
+
* Callback called continuously as the marker is dragged
|
|
138
|
+
*
|
|
139
|
+
* @platform iOS: Apple Maps only
|
|
140
|
+
* @platform Android: Supported
|
|
141
|
+
*/
|
|
142
|
+
onDrag?: (event: MarkerDragEvent) => void;
|
|
143
|
+
/**
|
|
144
|
+
* Callback that is called when a drag on the marker finishes.
|
|
145
|
+
* This is usually the point you will want to setState on the marker's coordinate again
|
|
146
|
+
*
|
|
147
|
+
* @platform iOS: Apple Maps only
|
|
148
|
+
* @platform Android: Supported
|
|
149
|
+
*/
|
|
150
|
+
onDragEnd?: (event: MarkerDragStartEndEvent) => void;
|
|
151
|
+
/**
|
|
152
|
+
* Callback that is called when the user initiates a drag on the marker (if it is draggable)
|
|
153
|
+
*
|
|
154
|
+
* @platform iOS: Apple Maps only
|
|
155
|
+
* @platform Android: Supported
|
|
156
|
+
*/
|
|
157
|
+
onDragStart?: (event: MarkerDragStartEndEvent) => void;
|
|
158
|
+
/**
|
|
159
|
+
* Callback that is called when the marker is tapped by the user.
|
|
160
|
+
*
|
|
161
|
+
* @platform iOS: Supported
|
|
162
|
+
* @platform Android: Supported
|
|
163
|
+
*/
|
|
164
|
+
onPress?: (event: MarkerPressEvent) => void;
|
|
165
|
+
/**
|
|
166
|
+
* Callback that is called when the marker becomes selected.
|
|
167
|
+
* This will be called when the callout for that marker is about to be shown.
|
|
168
|
+
*
|
|
169
|
+
* @platform iOS: Apple Maps only.
|
|
170
|
+
* @platform Android: Not supported
|
|
171
|
+
*/
|
|
172
|
+
onSelect?: (event: MarkerSelectEvent) => void;
|
|
173
|
+
/**
|
|
174
|
+
* The marker's opacity between 0.0 and 1.0.
|
|
175
|
+
*
|
|
176
|
+
* @default 1.0
|
|
177
|
+
* @platform iOS: Supported
|
|
178
|
+
* @platform Android: Supported
|
|
179
|
+
*/
|
|
180
|
+
opacity?: number;
|
|
181
|
+
/**
|
|
182
|
+
* If no custom marker view or custom image is provided, the platform default pin will be used, which can be customized by this color.
|
|
183
|
+
* Ignored if a custom marker is being used.<br/><br/>
|
|
184
|
+
* For Android, the set of available colors is limited. Unsupported colors will fall back to red.
|
|
185
|
+
* See [#887](https://github.com/react-community/react-native-maps/issues/887) for more information.
|
|
186
|
+
*
|
|
187
|
+
* @platform iOS: Supported
|
|
188
|
+
* @platform Android: Supported
|
|
189
|
+
*/
|
|
190
|
+
pinColor?: string;
|
|
191
|
+
/**
|
|
192
|
+
* A float number indicating marker's rotation angle, in degrees.
|
|
193
|
+
*
|
|
194
|
+
* @default 0
|
|
195
|
+
* @platform iOS: Google Maps only
|
|
196
|
+
* @platform Android: Supported
|
|
197
|
+
*/
|
|
198
|
+
rotation?: number;
|
|
199
|
+
/**
|
|
200
|
+
* Sets whether this marker should propagate `onPress` events.
|
|
201
|
+
* Enabling it will stop the parent `MapView`'s `onPress` from being called.
|
|
202
|
+
*
|
|
203
|
+
* Android does not propagate `onPress` events.
|
|
204
|
+
*
|
|
205
|
+
* See [#1132](https://github.com/react-community/react-native-maps/issues/1132) for more information.
|
|
206
|
+
*
|
|
207
|
+
* @default false
|
|
208
|
+
* @platform iOS: Apple Maps only
|
|
209
|
+
* @platform Android: Not supported
|
|
210
|
+
*/
|
|
211
|
+
stopPropagation?: boolean;
|
|
212
|
+
/**
|
|
213
|
+
* Sets whether marker should be tappable.
|
|
214
|
+
* If set to false, the marker will not have onPress events.
|
|
215
|
+
*
|
|
216
|
+
* @default true
|
|
217
|
+
* @platform iOS: Google Maps only
|
|
218
|
+
* @platform Android: Not supported
|
|
219
|
+
*/
|
|
220
|
+
tappable?: boolean;
|
|
221
|
+
/**
|
|
222
|
+
* The title of the marker.
|
|
223
|
+
* This is only used if the <Marker /> component has no `<Callout />` children.
|
|
224
|
+
*
|
|
225
|
+
* If the marker has <Callout /> children, default callout behavior will be used,
|
|
226
|
+
* which will show both the `title` and the `description`, if provided.
|
|
227
|
+
*
|
|
228
|
+
* @platform iOS: Supported
|
|
229
|
+
* @platform Android: Supported
|
|
230
|
+
*/
|
|
231
|
+
title?: string;
|
|
232
|
+
/**
|
|
233
|
+
* Sets whether this marker should track view changes in info window.
|
|
234
|
+
* Enabling it will let marker change content of info window after first render pass, but will lead to decreased performance,
|
|
235
|
+
* so it's recommended to disable it whenever you don't need it.
|
|
236
|
+
* **Note**: iOS Google Maps only.
|
|
237
|
+
*
|
|
238
|
+
* @default false
|
|
239
|
+
* @platform iOS: Google Maps only
|
|
240
|
+
* @platform Android: Not supported
|
|
241
|
+
*/
|
|
242
|
+
tracksInfoWindowChanges?: boolean;
|
|
243
|
+
/**
|
|
244
|
+
* Sets whether this marker should track view changes.
|
|
245
|
+
* It's recommended to turn it off whenever it's possible to improve custom marker performance.
|
|
246
|
+
*
|
|
247
|
+
* @default true
|
|
248
|
+
* @platform iOS: Google Maps only
|
|
249
|
+
* @platform Android: Supported
|
|
250
|
+
*/
|
|
251
|
+
tracksViewChanges?: boolean;
|
|
252
|
+
/**
|
|
253
|
+
* The order in which this tile overlay is drawn with respect to other overlays.
|
|
254
|
+
* An overlay with a larger z-index is drawn over overlays with smaller z-indices.
|
|
255
|
+
* The order of overlays with the same z-index is arbitrary.
|
|
256
|
+
*
|
|
257
|
+
* @platform iOS: Supported
|
|
258
|
+
* @platform Android: Supported
|
|
259
|
+
*/
|
|
260
|
+
zIndex?: number;
|
|
261
|
+
};
|
|
262
|
+
declare type OmittedProps = Omit<Props, 'stopPropagation'>;
|
|
263
|
+
declare type NativeProps = Modify<OmittedProps, {
|
|
264
|
+
icon?: string;
|
|
265
|
+
image?: Props['image'] | string;
|
|
266
|
+
}> & {
|
|
267
|
+
ref: React.RefObject<View>;
|
|
268
|
+
};
|
|
269
|
+
export declare class MapMarker extends React.Component<Props> {
|
|
270
|
+
context: React.ContextType<typeof ProviderContext>;
|
|
271
|
+
getNativeComponent: () => NativeComponent<NativeProps>;
|
|
272
|
+
getMapManagerCommand: (name: string) => MapManagerCommand;
|
|
273
|
+
getUIManagerCommand: (name: string) => UIManagerCommand;
|
|
274
|
+
static Animated: Animated.AnimatedComponent<typeof MapMarker>;
|
|
275
|
+
private marker;
|
|
276
|
+
constructor(props: Props);
|
|
277
|
+
setNativeProps(props: Partial<NativeProps>): void;
|
|
278
|
+
showCallout(): void;
|
|
279
|
+
hideCallout(): void;
|
|
280
|
+
redrawCallout(): void;
|
|
281
|
+
animateMarkerToCoordinate(coordinate: LatLng, duration?: number): void;
|
|
282
|
+
redraw(): void;
|
|
283
|
+
_getHandle(): number | null;
|
|
284
|
+
_runCommand(name: NativeCommandName, args: any[]): void;
|
|
285
|
+
render(): JSX.Element;
|
|
286
|
+
}
|
|
287
|
+
declare const _default: typeof MapMarker;
|
|
288
|
+
export default _default;
|
|
289
|
+
declare type NativeCommandName = 'showCallout' | 'hideCallout' | 'redrawCallout' | 'animateMarkerToCoordinate' | 'redraw';
|
package/lib/MapMarker.js
ADDED
|
@@ -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
|
+
});
|