react-native-maps 2.0.0-beta.1 → 2.0.0-beta.10
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 +34 -11
- package/android/build.gradle +41 -10
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapCalloutManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapCircleManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapGradientPolyline.java +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapGradientPolylineManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapHeatmapManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapLiteManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapLocalTile.java +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapLocalTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +6 -63
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +2 -2
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +10 -27
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolygonManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapPolylineManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapTileProvider.java +7 -5
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +72 -150
- package/android/src/main/java/com/rnmaps/maps/MapViewModule.java +598 -0
- package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +6 -6
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/SizeReportingShadowNode.java +1 -1
- package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.m +8 -0
- package/ios/{AirGoogleMaps/AIRDummyView.h → GoogleMaps/RNMDummyView.h} +3 -3
- package/ios/{AirGoogleMaps/AIRDummyView.m → GoogleMaps/RNMDummyView.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSMarker.h → GoogleMaps/RNMGMSMarker.h} +6 -6
- package/ios/{AirGoogleMaps/AIRGMSMarker.m → GoogleMaps/RNMGMSMarker.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolygon.h → GoogleMaps/RNMGMSPolygon.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolygon.m → GoogleMaps/RNMGMSPolygon.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolyline.h → GoogleMaps/RNMGMSPolyline.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGMSPolyline.m → GoogleMaps/RNMGMSPolyline.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMap.h → GoogleMaps/RNMGoogleMap.h} +5 -5
- package/ios/{AirGoogleMaps/AIRGoogleMap.m → GoogleMaps/RNMGoogleMap.m} +81 -77
- package/ios/{AirGoogleMaps/AIRGoogleMapCallout.h → GoogleMaps/RNMGoogleMapCallout.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCallout.m → GoogleMaps/RNMGoogleMapCallout.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.h → GoogleMaps/RNMGoogleMapCalloutManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutManager.m → GoogleMaps/RNMGoogleMapCalloutManager.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.h → GoogleMaps/RNMGoogleMapCalloutSubview.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubview.m → GoogleMaps/RNMGoogleMapCalloutSubview.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.h → GoogleMaps/RNMGoogleMapCalloutSubviewManager.h} +3 -3
- package/ios/GoogleMaps/RNMGoogleMapCalloutSubviewManager.m +28 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapCircle.h → GoogleMaps/RNMGoogleMapCircle.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCircle.m → GoogleMaps/RNMGoogleMapCircle.m} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.h → GoogleMaps/RNMGoogleMapCircleManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapCircleManager.m → GoogleMaps/RNMGoogleMapCircleManager.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.h → GoogleMaps/RNMGoogleMapHeatmap.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmap.m → GoogleMaps/RNMGoogleMapHeatmap.m} +4 -4
- package/ios/GoogleMaps/RNMGoogleMapHeatmapManager.h +11 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapHeatmapManager.m → GoogleMaps/RNMGoogleMapHeatmapManager.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapManager.h → GoogleMaps/RNMGoogleMapManager.h} +3 -3
- package/ios/GoogleMaps/RNMGoogleMapManager.m +256 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapMarker.h → GoogleMaps/RNMGoogleMapMarker.h} +15 -15
- package/ios/{AirGoogleMaps/AIRGoogleMapMarker.m → GoogleMaps/RNMGoogleMapMarker.m} +23 -23
- package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.h → GoogleMaps/RNMGoogleMapMarkerManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapMarkerManager.m → GoogleMaps/RNMGoogleMapMarkerManager.m} +20 -20
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.h → GoogleMaps/RNMGoogleMapOverlay.h} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlay.m → GoogleMaps/RNMGoogleMapOverlay.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.h → GoogleMaps/RNMGoogleMapOverlayManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapOverlayManager.m → GoogleMaps/RNMGoogleMapOverlayManager.m} +6 -6
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.h → GoogleMaps/RNMGoogleMapPolygon.h} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygon.m → GoogleMaps/RNMGoogleMapPolygon.m} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.h → GoogleMaps/RNMGoogleMapPolygonManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.m → GoogleMaps/RNMGoogleMapPolygonManager.m} +10 -10
- package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.h → GoogleMaps/RNMGoogleMapPolyline.h} +7 -7
- package/ios/{AirGoogleMaps/AIRGoogleMapPolyline.m → GoogleMaps/RNMGoogleMapPolyline.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapPolygonManager.h → GoogleMaps/RNMGoogleMapPolylineManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapPolylineManager.m → GoogleMaps/RNMGoogleMapPolylineManager.m} +9 -9
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.h → GoogleMaps/RNMGoogleMapUrlTile.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTile.m → GoogleMaps/RNMGoogleMapUrlTile.m} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapUrlTileManager.h → GoogleMaps/RNMGoogleMapUrlTileManager.h} +2 -2
- package/ios/{AirGoogleMaps/AIRGoogleMapURLTileManager.m → GoogleMaps/RNMGoogleMapUrlTileManager.m} +7 -7
- package/ios/GoogleMaps/RNMGoogleMapViewModule.h +5 -0
- package/ios/GoogleMaps/RNMGoogleMapViewModule.m +380 -0
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.h → GoogleMaps/RNMGoogleMapWMSTile.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTile.m → GoogleMaps/RNMGoogleMapWMSTile.m} +4 -4
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.h → GoogleMaps/RNMGoogleMapWMSTileManager.h} +3 -3
- package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.m → GoogleMaps/RNMGoogleMapWMSTileManager.m} +8 -8
- package/ios/{AirMaps → Maps}/Callout/SMCalloutView.h +4 -4
- package/ios/{AirMaps/RCTConvert+AirMap.h → Maps/RCTConvert+RNMMap.h} +1 -1
- package/ios/{AirMaps/RCTConvert+AirMap.m → Maps/RCTConvert+RNMMap.m} +25 -8
- package/ios/{AirMaps/AIRMap.h → Maps/RNMMap.h} +8 -8
- package/ios/{AirMaps/AIRMap.m → Maps/RNMMap.m} +60 -56
- package/ios/{AirMaps/AIRMapCallout.h → Maps/RNMMapCallout.h} +1 -1
- package/ios/{AirMaps/AIRMapCallout.m → Maps/RNMMapCallout.m} +2 -2
- package/ios/{AirMaps/AIRMapCircleManager.h → Maps/RNMMapCalloutManager.h} +2 -2
- package/ios/{AirMaps/AIRMapCalloutManager.m → Maps/RNMMapCalloutManager.m} +7 -7
- package/ios/{AirMaps/AIRMapCalloutSubview.h → Maps/RNMMapCalloutSubview.h} +3 -3
- package/ios/{AirMaps/AIRMapCalloutSubview.m → Maps/RNMMapCalloutSubview.m} +4 -4
- package/ios/Maps/RNMMapCalloutSubviewManager.h +14 -0
- package/ios/Maps/RNMMapCalloutSubviewManager.m +24 -0
- package/ios/{AirMaps/AIRMapCircle.h → Maps/RNMMapCircle.h} +5 -5
- package/ios/{AirMaps/AIRMapCircle.m → Maps/RNMMapCircle.m} +3 -3
- package/ios/{AirMaps/AIRMapCalloutManager.h → Maps/RNMMapCircleManager.h} +2 -2
- package/ios/{AirMaps/AIRMapCircleManager.m → Maps/RNMMapCircleManager.m} +7 -7
- package/ios/{AirMaps/AIRMapCoordinate.h → Maps/RNMMapCoordinate.h} +2 -2
- package/ios/{AirMaps/AIRMapCoordinate.m → Maps/RNMMapCoordinate.m} +3 -3
- package/ios/{AirMaps/AIRMapLocalTile.h → Maps/RNMMapLocalTile.h} +7 -7
- package/ios/{AirMaps/AIRMapLocalTile.m → Maps/RNMMapLocalTile.m} +6 -6
- package/ios/{AirMaps/AIRMapLocalTileManager.h → Maps/RNMMapLocalTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapLocalTileManager.m → Maps/RNMMapLocalTileManager.m} +9 -9
- package/ios/{AirMaps/AIRMapLocalTileOverlay.h → Maps/RNMMapLocalTileOverlay.h} +2 -2
- package/ios/{AirMaps/AIRMapLocalTileOverlay.m → Maps/RNMMapLocalTileOverlay.m} +5 -5
- package/ios/{AirMaps/AIRMapManager.h → Maps/RNMMapManager.h} +6 -6
- package/ios/Maps/RNMMapManager.m +854 -0
- package/ios/{AirMaps/AIRMapMarker.h → Maps/RNMMapMarker.h} +8 -8
- package/ios/{AirMaps/AIRMapMarker.m → Maps/RNMMapMarker.m} +13 -13
- package/ios/{AirMaps/AIRMapMarkerManager.h → Maps/RNMMapMarkerManager.h} +1 -1
- package/ios/{AirMaps/AIRMapMarkerManager.m → Maps/RNMMapMarkerManager.m} +14 -14
- package/ios/{AirMaps/AIRMapOverlay.h → Maps/RNMMapOverlay.h} +7 -7
- package/ios/{AirMaps/AIRMapOverlay.m → Maps/RNMMapOverlay.m} +4 -4
- package/ios/Maps/RNMMapOverlayManager.h +5 -0
- package/ios/{AirMaps/AIRMapOverlayManager.m → Maps/RNMMapOverlayManager.m} +6 -6
- package/ios/{AirMaps/AIRMapOverlayRenderer.h → Maps/RNMMapOverlayRenderer.h} +1 -1
- package/ios/{AirMaps/AIRMapOverlayRenderer.m → Maps/RNMMapOverlayRenderer.m} +5 -5
- package/ios/{AirMaps/AIRMapPolygon.h → Maps/RNMMapPolygon.h} +7 -7
- package/ios/{AirMaps/AIRMapPolygon.m → Maps/RNMMapPolygon.m} +4 -4
- package/ios/{AirMaps/AIRMapPolygonManager.h → Maps/RNMMapPolygonManager.h} +2 -2
- package/ios/{AirMaps/AIRMapPolygonManager.m → Maps/RNMMapPolygonManager.m} +10 -10
- package/ios/{AirMaps/AIRMapPolyline.h → Maps/RNMMapPolyline.h} +6 -6
- package/ios/{AirMaps/AIRMapPolyline.m → Maps/RNMMapPolyline.m} +11 -11
- package/ios/{AirMaps/AIRMapPolylineManager.h → Maps/RNMMapPolylineManager.h} +2 -2
- package/ios/{AirMaps/AIRMapPolylineManager.m → Maps/RNMMapPolylineManager.m} +9 -9
- package/ios/{AirMaps/AIRMapPolylineRenderer.h → Maps/RNMMapPolylineRenderer.h} +2 -2
- package/ios/{AirMaps/AIRMapPolylineRenderer.m → Maps/RNMMapPolylineRenderer.m} +10 -10
- package/ios/{AirMaps/AIRMapSnapshot.h → Maps/RNMMapSnapshot.h} +6 -6
- package/ios/{AirMaps/AIRMapUrlTile.h → Maps/RNMMapUrlTile.h} +18 -18
- package/ios/{AirMaps/AIRMapUrlTile.m → Maps/RNMMapUrlTile.m} +7 -7
- package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.h → Maps/RNMMapUrlTileCachedOverlay.h} +3 -3
- package/ios/{AirMaps/AIRMapUrlTileCachedOverlay.m → Maps/RNMMapUrlTileCachedOverlay.m} +10 -10
- package/ios/{AirMaps/AIRMapUrlTileManager.h → Maps/RNMMapUrlTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapUrlTileManager.m → Maps/RNMMapUrlTileManager.m} +9 -9
- package/ios/Maps/RNMMapViewModule.h +5 -0
- package/ios/Maps/RNMMapViewModule.m +459 -0
- package/ios/{AirMaps/AIRMapWMSTile.h → Maps/RNMMapWMSTile.h} +11 -11
- package/ios/{AirMaps/AIRMapWMSTile.m → Maps/RNMMapWMSTile.m} +15 -15
- package/ios/{AirMaps/AIRMapWMSTileManager.h → Maps/RNMMapWMSTileManager.h} +3 -3
- package/ios/{AirMaps/AIRMapWMSTileManager.m → Maps/RNMMapWMSTileManager.m} +9 -9
- package/ios/RNMaps.xcodeproj/project.pbxproj +647 -0
- package/lib/Geojson.d.ts +1 -1
- package/lib/MapCallout.js +2 -2
- package/lib/MapCalloutSubview.js +2 -2
- package/lib/MapCircle.js +2 -2
- package/lib/MapHeatmap.js +2 -2
- package/lib/MapLocalTile.js +2 -2
- package/lib/MapMarker.d.ts +2 -3
- package/lib/MapMarker.js +2 -4
- package/lib/MapOverlay.d.ts +1 -2
- package/lib/MapOverlay.js +2 -4
- package/lib/MapPolygon.js +2 -2
- package/lib/MapPolyline.js +2 -2
- package/lib/MapUrlTile.js +2 -2
- package/lib/MapView.d.ts +14 -14
- package/lib/MapView.js +92 -107
- package/lib/MapView.types.d.ts +8 -3
- package/lib/MapViewNativeComponent.d.ts +1 -8
- package/lib/MapViewNativeComponent.js +1 -10
- package/lib/MapWMSTile.js +2 -2
- package/lib/NativeGoogleMapViewModule.d.ts +25 -0
- package/lib/NativeGoogleMapViewModule.js +4 -0
- package/lib/NativeMapViewModule.d.ts +29 -0
- package/lib/NativeMapViewModule.js +4 -0
- package/lib/decorateMapComponent.d.ts +1 -1
- package/lib/decorateMapComponent.js +3 -3
- package/lib/index.d.ts +14 -21
- package/lib/index.js +10 -38
- package/package.json +6 -6
- package/react-native-google-maps.podspec +1 -1
- package/react-native-maps.podspec +2 -2
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +0 -380
- package/ios/AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.m +0 -28
- package/ios/AirGoogleMaps/AIRGoogleMapHeatmapManager.h +0 -11
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -597
- package/ios/AirMaps/AIRMapCalloutSubviewManager.h +0 -14
- package/ios/AirMaps/AIRMapCalloutSubviewManager.m +0 -24
- package/ios/AirMaps/AIRMapManager.m +0 -1253
- package/ios/AirMaps/AIRMapOverlayManager.h +0 -5
- package/ios/AirMaps/AIRWeakMapReference.h +0 -24
- package/ios/AirMaps/AIRWeakMapReference.m +0 -23
- package/ios/AirMaps/AIRWeakTimerReference.h +0 -21
- package/ios/AirMaps/AIRWeakTimerReference.m +0 -42
- package/ios/AirMaps.xcodeproj/project.pbxproj +0 -587
- /package/ios/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.h +0 -0
- /package/ios/{AirMaps → Maps}/Callout/SMCalloutView.m +0 -0
package/lib/Geojson.d.ts
CHANGED
|
@@ -136,7 +136,7 @@ export type GeojsonProps = {
|
|
|
136
136
|
* This is the default value for all point markers in your geojson data. It can be overriden
|
|
137
137
|
* on a per point basis by adding a `trackViewChanges` property to the `properties` object on the point.
|
|
138
138
|
*
|
|
139
|
-
* @default
|
|
139
|
+
* @default false
|
|
140
140
|
* @platform iOS: Google Maps only
|
|
141
141
|
* @platform Android: Supported
|
|
142
142
|
*/
|
package/lib/MapCallout.js
CHANGED
|
@@ -33,8 +33,8 @@ class MapCallout extends React.Component {
|
|
|
33
33
|
getUIManagerCommand;
|
|
34
34
|
render() {
|
|
35
35
|
const { tooltip = false, alphaHitTest = false } = this.props;
|
|
36
|
-
const
|
|
37
|
-
return (<
|
|
36
|
+
const RNMMapCallout = this.getNativeComponent();
|
|
37
|
+
return (<RNMMapCallout {...this.props} tooltip={tooltip} alphaHitTest={alphaHitTest} style={[styles.callout, this.props.style]}/>);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
exports.MapCallout = MapCallout;
|
package/lib/MapCalloutSubview.js
CHANGED
|
@@ -32,8 +32,8 @@ class MapCalloutSubview extends React.Component {
|
|
|
32
32
|
getMapManagerCommand;
|
|
33
33
|
getUIManagerCommand;
|
|
34
34
|
render() {
|
|
35
|
-
const
|
|
36
|
-
return (<
|
|
35
|
+
const RNMMapCalloutSubview = this.getNativeComponent();
|
|
36
|
+
return (<RNMMapCalloutSubview {...this.props} style={[styles.calloutSubview, this.props.style]}/>);
|
|
37
37
|
}
|
|
38
38
|
}
|
|
39
39
|
exports.MapCalloutSubview = MapCalloutSubview;
|
package/lib/MapCircle.js
CHANGED
|
@@ -40,8 +40,8 @@ class MapCircle extends React.Component {
|
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
42
|
const { strokeColor = '#000', strokeWidth = 1 } = this.props;
|
|
43
|
-
const
|
|
44
|
-
return (<
|
|
43
|
+
const RNMMapCircle = this.getNativeComponent();
|
|
44
|
+
return (<RNMMapCircle {...this.props} strokeColor={strokeColor} strokeWidth={strokeWidth} ref={this.circle}/>);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.MapCircle = MapCircle;
|
package/lib/MapHeatmap.js
CHANGED
|
@@ -40,14 +40,14 @@ class MapHeatmap extends React.Component {
|
|
|
40
40
|
this.heatmap.current?.setNativeProps(props);
|
|
41
41
|
}
|
|
42
42
|
render() {
|
|
43
|
-
const
|
|
43
|
+
const RNMMapHeatmap = this.getNativeComponent();
|
|
44
44
|
const propGradient = this.props.gradient;
|
|
45
45
|
let gradient;
|
|
46
46
|
if (propGradient) {
|
|
47
47
|
const colors = propGradient.colors.map(c => (0, react_native_1.processColor)(c));
|
|
48
48
|
gradient = { ...propGradient, colors };
|
|
49
49
|
}
|
|
50
|
-
return (<
|
|
50
|
+
return (<RNMMapHeatmap {...this.props} gradient={gradient} ref={this.heatmap}/>);
|
|
51
51
|
}
|
|
52
52
|
}
|
|
53
53
|
exports.MapHeatmap = MapHeatmap;
|
package/lib/MapLocalTile.js
CHANGED
|
@@ -31,8 +31,8 @@ class MapLocalTile extends React.Component {
|
|
|
31
31
|
getMapManagerCommand;
|
|
32
32
|
getUIManagerCommand;
|
|
33
33
|
render() {
|
|
34
|
-
const
|
|
35
|
-
return <
|
|
34
|
+
const RNMMapLocalTile = this.getNativeComponent();
|
|
35
|
+
return <RNMMapLocalTile {...this.props}/>;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.MapLocalTile = MapLocalTile;
|
package/lib/MapMarker.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewProps, ImageURISource, ImageRequireSource } from 'react-native';
|
|
3
3
|
import { MapManagerCommand, NativeComponent, ProviderContext, UIManagerCommand } from './decorateMapComponent';
|
|
4
4
|
import { MapMarkerNativeComponentType } from './MapMarkerNativeComponent';
|
|
5
5
|
import { CalloutPressEvent, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Point } from './sharedTypes';
|
|
@@ -246,7 +246,7 @@ export type MapMarkerProps = ViewProps & {
|
|
|
246
246
|
* Sets whether this marker should track view changes.
|
|
247
247
|
* It's recommended to turn it off whenever it's possible to improve custom marker performance.
|
|
248
248
|
*
|
|
249
|
-
* @default
|
|
249
|
+
* @default false
|
|
250
250
|
* @platform iOS: Google Maps only
|
|
251
251
|
* @platform Android: Supported
|
|
252
252
|
*/
|
|
@@ -273,7 +273,6 @@ export declare class MapMarker extends React.Component<MapMarkerProps> {
|
|
|
273
273
|
getNativeComponent: () => NativeComponent<NativeProps>;
|
|
274
274
|
getMapManagerCommand: (name: string) => MapManagerCommand;
|
|
275
275
|
getUIManagerCommand: (name: string) => UIManagerCommand;
|
|
276
|
-
static Animated: Animated.AnimatedComponent<typeof MapMarker>;
|
|
277
276
|
private marker;
|
|
278
277
|
constructor(props: MapMarkerProps);
|
|
279
278
|
/**
|
package/lib/MapMarker.js
CHANGED
|
@@ -32,7 +32,6 @@ class MapMarker extends React.Component {
|
|
|
32
32
|
getNativeComponent;
|
|
33
33
|
getMapManagerCommand;
|
|
34
34
|
getUIManagerCommand;
|
|
35
|
-
static Animated;
|
|
36
35
|
marker;
|
|
37
36
|
constructor(props) {
|
|
38
37
|
super(props);
|
|
@@ -88,8 +87,8 @@ class MapMarker extends React.Component {
|
|
|
88
87
|
icon = react_native_1.Image.resolveAssetSource(this.props.icon) || {};
|
|
89
88
|
icon = icon.uri;
|
|
90
89
|
}
|
|
91
|
-
const
|
|
92
|
-
return (<
|
|
90
|
+
const RNMMapMarker = this.getNativeComponent();
|
|
91
|
+
return (<RNMMapMarker {...this.props} ref={this.marker} image={image} icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
|
|
93
92
|
if (stopPropagation) {
|
|
94
93
|
event.stopPropagation();
|
|
95
94
|
}
|
|
@@ -106,7 +105,6 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
106
105
|
backgroundColor: 'transparent',
|
|
107
106
|
},
|
|
108
107
|
});
|
|
109
|
-
MapMarker.Animated = react_native_1.Animated.createAnimatedComponent(MapMarker);
|
|
110
108
|
exports.default = (0, decorateMapComponent_1.default)(MapMarker, 'Marker', {
|
|
111
109
|
google: {
|
|
112
110
|
ios: decorateMapComponent_1.SUPPORTED,
|
package/lib/MapOverlay.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { ViewProps, ImageURISource, ImageRequireSource, NativeSyntheticEvent } from 'react-native';
|
|
3
3
|
import { MapManagerCommand, NativeComponent, ProviderContext, UIManagerCommand } from './decorateMapComponent';
|
|
4
4
|
import { LatLng, Point } from './sharedTypes';
|
|
5
5
|
import { Modify } from './sharedTypesInternal';
|
|
@@ -59,7 +59,6 @@ export declare class MapOverlay extends React.Component<MapOverlayProps> {
|
|
|
59
59
|
getNativeComponent: () => NativeComponent<NativeProps>;
|
|
60
60
|
getMapManagerCommand: (name: string) => MapManagerCommand;
|
|
61
61
|
getUIManagerCommand: (name: string) => UIManagerCommand;
|
|
62
|
-
static Animated: Animated.AnimatedComponent<typeof MapOverlay>;
|
|
63
62
|
render(): JSX.Element;
|
|
64
63
|
}
|
|
65
64
|
type Coordinate = [number, number];
|
package/lib/MapOverlay.js
CHANGED
|
@@ -31,7 +31,6 @@ class MapOverlay extends React.Component {
|
|
|
31
31
|
getNativeComponent;
|
|
32
32
|
getMapManagerCommand;
|
|
33
33
|
getUIManagerCommand;
|
|
34
|
-
static Animated;
|
|
35
34
|
render() {
|
|
36
35
|
const { opacity = 1.0 } = this.props;
|
|
37
36
|
let image;
|
|
@@ -43,8 +42,8 @@ class MapOverlay extends React.Component {
|
|
|
43
42
|
const sourceAsset = react_native_1.Image.resolveAssetSource(this.props.image) || {};
|
|
44
43
|
image = sourceAsset.uri;
|
|
45
44
|
}
|
|
46
|
-
const
|
|
47
|
-
return (<
|
|
45
|
+
const RNMMapOverlay = this.getNativeComponent();
|
|
46
|
+
return (<RNMMapOverlay {...this.props} opacity={opacity} image={image} style={[styles.overlay, this.props.style]}/>);
|
|
48
47
|
}
|
|
49
48
|
}
|
|
50
49
|
exports.MapOverlay = MapOverlay;
|
|
@@ -54,7 +53,6 @@ const styles = react_native_1.StyleSheet.create({
|
|
|
54
53
|
backgroundColor: 'transparent',
|
|
55
54
|
},
|
|
56
55
|
});
|
|
57
|
-
MapOverlay.Animated = react_native_1.Animated.createAnimatedComponent(MapOverlay);
|
|
58
56
|
exports.default = (0, decorateMapComponent_1.default)(MapOverlay, 'Overlay', {
|
|
59
57
|
google: {
|
|
60
58
|
ios: decorateMapComponent_1.SUPPORTED,
|
package/lib/MapPolygon.js
CHANGED
|
@@ -40,8 +40,8 @@ class MapPolygon extends React.Component {
|
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
42
|
const { strokeColor = '#000', strokeWidth = 1 } = this.props;
|
|
43
|
-
const
|
|
44
|
-
return (<
|
|
43
|
+
const RNMMapPolygon = this.getNativeComponent();
|
|
44
|
+
return (<RNMMapPolygon {...this.props} strokeColor={strokeColor} strokeWidth={strokeWidth} ref={this.polygon}/>);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.MapPolygon = MapPolygon;
|
package/lib/MapPolyline.js
CHANGED
|
@@ -40,8 +40,8 @@ class MapPolyline extends React.Component {
|
|
|
40
40
|
}
|
|
41
41
|
render() {
|
|
42
42
|
const { strokeColor = '#000', strokeWidth = 1, lineJoin = 'round', lineCap = 'round', } = this.props;
|
|
43
|
-
const
|
|
44
|
-
return (<
|
|
43
|
+
const RNMMapPolyline = this.getNativeComponent();
|
|
44
|
+
return (<RNMMapPolyline {...this.props} strokeColor={strokeColor} strokeWidth={strokeWidth} lineJoin={lineJoin} lineCap={lineCap} ref={this.polyline}/>);
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
exports.MapPolyline = MapPolyline;
|
package/lib/MapUrlTile.js
CHANGED
|
@@ -31,8 +31,8 @@ class MapUrlTile extends React.Component {
|
|
|
31
31
|
getMapManagerCommand;
|
|
32
32
|
getUIManagerCommand;
|
|
33
33
|
render() {
|
|
34
|
-
const
|
|
35
|
-
return <
|
|
34
|
+
const RNMMapUrlTile = this.getNativeComponent();
|
|
35
|
+
return <RNMMapUrlTile {...this.props}/>;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
exports.MapUrlTile = MapUrlTile;
|
package/lib/MapView.d.ts
CHANGED
|
@@ -1,11 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import { NativeSyntheticEvent, ViewProps } from 'react-native';
|
|
3
3
|
import { CalloutPressEvent, ClickEvent, Frame, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Point, Provider, Region } from './sharedTypes';
|
|
4
4
|
import { Address, BoundingBox, Camera, ChangeEvent, Details, EdgePadding, FitToOptions, IndoorBuildingEvent, IndoorLevelActivatedEvent, KmlMapEvent, LongPressEvent, MapPressEvent, MapStyleElement, MapType, MapTypes, PanDragEvent, PoiClickEvent, SnapshotOptions, UserLocationChangeEvent } from './MapView.types';
|
|
5
5
|
import { Modify } from './sharedTypesInternal';
|
|
6
6
|
import { MapViewNativeComponentType } from './MapViewNativeComponent';
|
|
7
7
|
export declare const MAP_TYPES: MapTypes;
|
|
8
8
|
export type MapViewProps = ViewProps & {
|
|
9
|
+
/**
|
|
10
|
+
* A boundary of an area within which the map’s center needs to remain.
|
|
11
|
+
* @platform iOS: Supported
|
|
12
|
+
* @platform Android: Supported
|
|
13
|
+
*/
|
|
14
|
+
boundary?: BoundingBox;
|
|
9
15
|
/**
|
|
10
16
|
* If `true` map will be cached and displayed as an image instead of being interactable, for performance usage.
|
|
11
17
|
*
|
|
@@ -570,7 +576,6 @@ type State = {
|
|
|
570
576
|
isReady: boolean;
|
|
571
577
|
};
|
|
572
578
|
declare class MapView extends React.Component<MapViewProps, State> {
|
|
573
|
-
static Animated: Animated.AnimatedComponent<typeof MapView>;
|
|
574
579
|
private map;
|
|
575
580
|
constructor(props: MapViewProps);
|
|
576
581
|
/**
|
|
@@ -582,20 +587,17 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
582
587
|
private _onChange;
|
|
583
588
|
getCamera(): Promise<Camera>;
|
|
584
589
|
setCamera(camera: Partial<Camera>): void;
|
|
585
|
-
animateCamera(camera: Partial<Camera>,
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
fitToSuppliedMarkers(markers: string[], options?: FitToOptions): void;
|
|
591
|
-
fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): void;
|
|
590
|
+
animateCamera(camera: Partial<Camera>, duration?: number): Promise<void>;
|
|
591
|
+
animateToRegion(region: Region, duration?: number): Promise<void>;
|
|
592
|
+
fitToElements(options?: FitToOptions): Promise<void>;
|
|
593
|
+
fitToSuppliedMarkers(markers: string[], options?: FitToOptions): Promise<void>;
|
|
594
|
+
fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): Promise<void>;
|
|
592
595
|
/**
|
|
593
596
|
* Get visible boudaries
|
|
594
597
|
*
|
|
595
598
|
* @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
596
599
|
*/
|
|
597
600
|
getMapBoundaries(): Promise<BoundingBox>;
|
|
598
|
-
setMapBoundaries(northEast: LatLng, southWest: LatLng): void;
|
|
599
601
|
setIndoorActiveLevelIndex(activeLevelIndex: number): void;
|
|
600
602
|
/**
|
|
601
603
|
* Takes a snapshot of the map and saves it to a picture
|
|
@@ -663,11 +665,9 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
663
665
|
* @return Object Object bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
664
666
|
*/
|
|
665
667
|
boundingBoxForRegion(region: Region): BoundingBox;
|
|
666
|
-
private _mapManagerCommand;
|
|
667
668
|
private _getHandle;
|
|
668
|
-
private
|
|
669
|
+
private _gogleMapsOniOS;
|
|
669
670
|
render(): JSX.Element;
|
|
670
671
|
}
|
|
671
|
-
export declare const
|
|
672
|
-
export declare const enableLatestRenderer: () => any;
|
|
672
|
+
export declare const enableLatestRenderer: () => Promise<string> | undefined;
|
|
673
673
|
export default MapView;
|
package/lib/MapView.js
CHANGED
|
@@ -22,13 +22,18 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
22
22
|
__setModuleDefault(result, mod);
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
26
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
|
+
};
|
|
25
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.enableLatestRenderer = exports.
|
|
29
|
+
exports.enableLatestRenderer = exports.MAP_TYPES = void 0;
|
|
27
30
|
const React = __importStar(require("react"));
|
|
28
31
|
const react_native_1 = require("react-native");
|
|
29
32
|
const decorateMapComponent_1 = require("./decorateMapComponent");
|
|
30
33
|
const ProviderConstants = __importStar(require("./ProviderConstants"));
|
|
31
34
|
const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
|
|
35
|
+
const NativeMapViewModule_1 = __importDefault(require("./NativeMapViewModule"));
|
|
36
|
+
const NativeGoogleMapViewModule_1 = __importDefault(require("./NativeGoogleMapViewModule"));
|
|
32
37
|
exports.MAP_TYPES = {
|
|
33
38
|
STANDARD: 'standard',
|
|
34
39
|
SATELLITE: 'satellite',
|
|
@@ -39,7 +44,6 @@ exports.MAP_TYPES = {
|
|
|
39
44
|
};
|
|
40
45
|
const GOOGLE_MAPS_ONLY_TYPES = [exports.MAP_TYPES.TERRAIN, exports.MAP_TYPES.NONE];
|
|
41
46
|
class MapView extends React.Component {
|
|
42
|
-
static Animated;
|
|
43
47
|
map;
|
|
44
48
|
constructor(props) {
|
|
45
49
|
super(props);
|
|
@@ -80,46 +84,48 @@ class MapView extends React.Component {
|
|
|
80
84
|
}
|
|
81
85
|
}
|
|
82
86
|
getCamera() {
|
|
83
|
-
if (
|
|
84
|
-
return
|
|
85
|
-
}
|
|
86
|
-
else if (react_native_1.Platform.OS === 'ios') {
|
|
87
|
-
return this._runCommand('getCamera', []);
|
|
87
|
+
if (this._gogleMapsOniOS()) {
|
|
88
|
+
return googleMapViewModuleMethod('getCamera')(this._getHandle());
|
|
88
89
|
}
|
|
89
|
-
return
|
|
90
|
+
return mapViewModuleMethod('getCamera')(this._getHandle());
|
|
90
91
|
}
|
|
91
92
|
setCamera(camera) {
|
|
92
93
|
if (this.map.current) {
|
|
93
94
|
MapViewNativeComponent_1.Commands.setCamera(this.map.current, camera);
|
|
94
95
|
}
|
|
95
96
|
}
|
|
96
|
-
animateCamera(camera,
|
|
97
|
-
if (this.
|
|
98
|
-
|
|
97
|
+
animateCamera(camera, duration = 500) {
|
|
98
|
+
if (this._gogleMapsOniOS()) {
|
|
99
|
+
return googleMapViewModuleMethod('animateCamera')(this._getHandle(), camera, duration);
|
|
99
100
|
}
|
|
101
|
+
return mapViewModuleMethod('animateCamera')(this._getHandle(), camera, duration);
|
|
100
102
|
}
|
|
101
103
|
animateToRegion(region, duration = 500) {
|
|
102
|
-
if (this.
|
|
103
|
-
|
|
104
|
+
if (this._gogleMapsOniOS()) {
|
|
105
|
+
return googleMapViewModuleMethod('animateToRegion')(this._getHandle(), region, duration);
|
|
104
106
|
}
|
|
107
|
+
return mapViewModuleMethod('animateToRegion')(this._getHandle(), region, duration);
|
|
105
108
|
}
|
|
106
109
|
fitToElements(options = {}) {
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
+
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
|
|
111
|
+
if (this._gogleMapsOniOS()) {
|
|
112
|
+
return googleMapViewModuleMethod('fitToElements')(this._getHandle(), edgePadding, duration);
|
|
110
113
|
}
|
|
114
|
+
return mapViewModuleMethod('fitToElements')(this._getHandle(), edgePadding, duration);
|
|
111
115
|
}
|
|
112
116
|
fitToSuppliedMarkers(markers, options = {}) {
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
117
|
+
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
|
|
118
|
+
if (this._gogleMapsOniOS()) {
|
|
119
|
+
return googleMapViewModuleMethod('fitToSuppliedMarkers')(this._getHandle(), markers, edgePadding, duration);
|
|
116
120
|
}
|
|
121
|
+
return mapViewModuleMethod('fitToSuppliedMarkers')(this._getHandle(), markers, edgePadding, duration);
|
|
117
122
|
}
|
|
118
123
|
fitToCoordinates(coordinates = [], options = {}) {
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
124
|
+
const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, duration = 0 } = options;
|
|
125
|
+
if (this._gogleMapsOniOS()) {
|
|
126
|
+
return googleMapViewModuleMethod('fitToCoordinates')(this._getHandle(), coordinates, edgePadding, duration);
|
|
122
127
|
}
|
|
128
|
+
return mapViewModuleMethod('fitToCoordinates')(this._getHandle(), coordinates, edgePadding, duration);
|
|
123
129
|
}
|
|
124
130
|
/**
|
|
125
131
|
* Get visible boudaries
|
|
@@ -127,18 +133,10 @@ class MapView extends React.Component {
|
|
|
127
133
|
* @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
128
134
|
*/
|
|
129
135
|
async getMapBoundaries() {
|
|
130
|
-
if (
|
|
131
|
-
return
|
|
132
|
-
}
|
|
133
|
-
else if (react_native_1.Platform.OS === 'ios') {
|
|
134
|
-
return await this._runCommand('getMapBoundaries', []);
|
|
135
|
-
}
|
|
136
|
-
return Promise.reject('getMapBoundaries not supported on this platform');
|
|
137
|
-
}
|
|
138
|
-
setMapBoundaries(northEast, southWest) {
|
|
139
|
-
if (this.map.current) {
|
|
140
|
-
MapViewNativeComponent_1.Commands.setMapBoundaries(this.map.current, northEast, southWest);
|
|
136
|
+
if (this._gogleMapsOniOS()) {
|
|
137
|
+
return googleMapViewModuleMethod('getMapBoundaries')(this._getHandle());
|
|
141
138
|
}
|
|
139
|
+
return mapViewModuleMethod('getMapBoundaries')(this._getHandle());
|
|
142
140
|
}
|
|
143
141
|
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
144
142
|
if (this.map.current) {
|
|
@@ -164,7 +162,7 @@ class MapView extends React.Component {
|
|
|
164
162
|
const config = {
|
|
165
163
|
width: args.width || 0,
|
|
166
164
|
height: args.height || 0,
|
|
167
|
-
region: args.region
|
|
165
|
+
region: args.region,
|
|
168
166
|
format: args.format || 'png',
|
|
169
167
|
quality: args.quality || 1.0,
|
|
170
168
|
result: args.result || 'file',
|
|
@@ -175,31 +173,10 @@ class MapView extends React.Component {
|
|
|
175
173
|
if (config.result !== 'file' && config.result !== 'base64') {
|
|
176
174
|
throw new Error('Invalid result specified');
|
|
177
175
|
}
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
return react_native_1.NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
|
|
176
|
+
if (this._gogleMapsOniOS()) {
|
|
177
|
+
return googleMapViewModuleMethod('takeSnapshot')(this._getHandle(), config);
|
|
181
178
|
}
|
|
182
|
-
|
|
183
|
-
return new Promise((resolve, reject) => {
|
|
184
|
-
this._runCommand('takeSnapshot', [
|
|
185
|
-
config.width,
|
|
186
|
-
config.height,
|
|
187
|
-
config.region,
|
|
188
|
-
config.format,
|
|
189
|
-
config.quality,
|
|
190
|
-
config.result,
|
|
191
|
-
(err, snapshot) => {
|
|
192
|
-
if (err) {
|
|
193
|
-
reject(err);
|
|
194
|
-
}
|
|
195
|
-
else {
|
|
196
|
-
resolve(snapshot);
|
|
197
|
-
}
|
|
198
|
-
},
|
|
199
|
-
]);
|
|
200
|
-
});
|
|
201
|
-
}
|
|
202
|
-
return Promise.reject('takeSnapshot not supported on this platform');
|
|
179
|
+
return mapViewModuleMethod('takeSnapshot')(this._getHandle(), config);
|
|
203
180
|
}
|
|
204
181
|
/**
|
|
205
182
|
* Convert a coordinate to address by using default Geocoder
|
|
@@ -211,13 +188,10 @@ class MapView extends React.Component {
|
|
|
211
188
|
* @return Promise with return type Address
|
|
212
189
|
*/
|
|
213
190
|
addressForCoordinate(coordinate) {
|
|
214
|
-
if (
|
|
215
|
-
|
|
216
|
-
}
|
|
217
|
-
else if (react_native_1.Platform.OS === 'ios') {
|
|
218
|
-
return this._runCommand('getAddressFromCoordinates', [coordinate]);
|
|
191
|
+
if (this._gogleMapsOniOS()) {
|
|
192
|
+
throw new Error('addressForCoordinate not supported on Google Maps iOS');
|
|
219
193
|
}
|
|
220
|
-
return
|
|
194
|
+
return mapViewModuleMethod('getAddressFromCoordinates')(this._getHandle(), coordinate);
|
|
221
195
|
}
|
|
222
196
|
/**
|
|
223
197
|
* Convert a map coordinate to user-space point
|
|
@@ -229,13 +203,10 @@ class MapView extends React.Component {
|
|
|
229
203
|
* @return Promise Promise with the point ({ x: Number, y: Number })
|
|
230
204
|
*/
|
|
231
205
|
pointForCoordinate(coordinate) {
|
|
232
|
-
if (
|
|
233
|
-
return
|
|
234
|
-
}
|
|
235
|
-
else if (react_native_1.Platform.OS === 'ios') {
|
|
236
|
-
return this._runCommand('pointForCoordinate', [coordinate]);
|
|
206
|
+
if (this._gogleMapsOniOS()) {
|
|
207
|
+
return googleMapViewModuleMethod('pointForCoordinate')(this._getHandle(), coordinate);
|
|
237
208
|
}
|
|
238
|
-
return
|
|
209
|
+
return mapViewModuleMethod('pointForCoordinate')(this._getHandle(), coordinate);
|
|
239
210
|
}
|
|
240
211
|
/**
|
|
241
212
|
* Convert a user-space point to a map coordinate
|
|
@@ -247,13 +218,10 @@ class MapView extends React.Component {
|
|
|
247
218
|
* @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
|
|
248
219
|
*/
|
|
249
220
|
coordinateForPoint(point) {
|
|
250
|
-
if (
|
|
251
|
-
return
|
|
221
|
+
if (this._gogleMapsOniOS()) {
|
|
222
|
+
return googleMapViewModuleMethod('coordinateForPoint')(this._getHandle(), point);
|
|
252
223
|
}
|
|
253
|
-
|
|
254
|
-
return this._runCommand('coordinateForPoint', [point]);
|
|
255
|
-
}
|
|
256
|
-
return Promise.reject('coordinateForPoint not supported on this platform');
|
|
224
|
+
return mapViewModuleMethod('coordinateForPoint')(this._getHandle(), point);
|
|
257
225
|
}
|
|
258
226
|
/**
|
|
259
227
|
* Get markers' centers and frames in user-space coordinates
|
|
@@ -263,10 +231,13 @@ class MapView extends React.Component {
|
|
|
263
231
|
* @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
|
|
264
232
|
*/
|
|
265
233
|
getMarkersFrames(onlyVisible = false) {
|
|
266
|
-
if (react_native_1.Platform.OS
|
|
267
|
-
|
|
234
|
+
if (react_native_1.Platform.OS !== 'ios') {
|
|
235
|
+
throw new Error('getMarkersFrames only supported on iOS');
|
|
236
|
+
}
|
|
237
|
+
if (this._gogleMapsOniOS()) {
|
|
238
|
+
return googleMapViewModuleMethod('getMarkersFrames')(this._getHandle(), onlyVisible);
|
|
268
239
|
}
|
|
269
|
-
return
|
|
240
|
+
return mapViewModuleMethod('getMarkersFrames')(this._getHandle(), onlyVisible);
|
|
270
241
|
}
|
|
271
242
|
/**
|
|
272
243
|
* Get bounding box from region
|
|
@@ -287,19 +258,15 @@ class MapView extends React.Component {
|
|
|
287
258
|
},
|
|
288
259
|
};
|
|
289
260
|
}
|
|
290
|
-
_mapManagerCommand(name) {
|
|
291
|
-
return react_native_1.NativeModules[`${(0, decorateMapComponent_1.getNativeMapName)(this.props.provider)}Manager`][name];
|
|
292
|
-
}
|
|
293
261
|
_getHandle() {
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
if (react_native_1.Platform.OS === 'ios') {
|
|
298
|
-
return this._mapManagerCommand(name)(this._getHandle(), ...args);
|
|
299
|
-
}
|
|
300
|
-
else {
|
|
301
|
-
return Promise.reject(`Invalid platform was passed: ${react_native_1.Platform.OS}`);
|
|
262
|
+
const handle = (0, react_native_1.findNodeHandle)(this.map.current);
|
|
263
|
+
if (!handle) {
|
|
264
|
+
throw new Error('Cannot find node handle');
|
|
302
265
|
}
|
|
266
|
+
return handle;
|
|
267
|
+
}
|
|
268
|
+
_gogleMapsOniOS() {
|
|
269
|
+
return react_native_1.Platform.OS === 'ios' && this.props.provider === 'google';
|
|
303
270
|
}
|
|
304
271
|
render() {
|
|
305
272
|
let props;
|
|
@@ -338,42 +305,60 @@ class MapView extends React.Component {
|
|
|
338
305
|
customMapStyleString: this.props.customMapStyle
|
|
339
306
|
? JSON.stringify(this.props.customMapStyle)
|
|
340
307
|
: undefined,
|
|
308
|
+
boundary: this.props.boundary,
|
|
341
309
|
};
|
|
342
310
|
}
|
|
343
311
|
if (react_native_1.Platform.OS === 'android' && this.props.liteMode) {
|
|
344
312
|
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
345
|
-
<
|
|
313
|
+
<RNMMapLite {...props}/>
|
|
346
314
|
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
347
315
|
}
|
|
348
|
-
const
|
|
316
|
+
const RNMMap = getNativeMapComponent(this.props.provider);
|
|
349
317
|
return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
|
|
350
|
-
<
|
|
318
|
+
<RNMMap {...props}/>
|
|
351
319
|
</decorateMapComponent_1.ProviderContext.Provider>);
|
|
352
320
|
}
|
|
353
321
|
}
|
|
354
|
-
const
|
|
355
|
-
default: (0, react_native_1.requireNativeComponent)('
|
|
322
|
+
const rnmMaps = {
|
|
323
|
+
default: (0, react_native_1.requireNativeComponent)('RNMMap'),
|
|
356
324
|
google: () => null,
|
|
357
325
|
};
|
|
358
326
|
if (react_native_1.Platform.OS === 'android') {
|
|
359
|
-
|
|
327
|
+
rnmMaps.google = rnmMaps.default;
|
|
360
328
|
}
|
|
361
329
|
else {
|
|
362
|
-
|
|
363
|
-
? (0, react_native_1.requireNativeComponent)('
|
|
364
|
-
: (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps:
|
|
330
|
+
rnmMaps.google = decorateMapComponent_1.googleMapIsInstalled
|
|
331
|
+
? (0, react_native_1.requireNativeComponent)('RNMGoogleMap')
|
|
332
|
+
: (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: RNMGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
|
|
365
333
|
}
|
|
366
|
-
const getNativeMapComponent = (provider) =>
|
|
367
|
-
const
|
|
368
|
-
? (0, react_native_1.requireNativeComponent)('
|
|
334
|
+
const getNativeMapComponent = (provider) => rnmMaps[provider || 'default'];
|
|
335
|
+
const RNMMapLite = react_native_1.UIManager.getViewManagerConfig('RNMMapLite')
|
|
336
|
+
? (0, react_native_1.requireNativeComponent)('RNMMapLite')
|
|
369
337
|
: () => null;
|
|
370
|
-
exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
|
|
371
338
|
const enableLatestRenderer = () => {
|
|
372
|
-
if (react_native_1.Platform.OS
|
|
373
|
-
return;
|
|
339
|
+
if (react_native_1.Platform.OS === 'android') {
|
|
340
|
+
return mapViewModuleMethod('enableLatestRenderer')();
|
|
374
341
|
}
|
|
375
|
-
return react_native_1.NativeModules.AirMapModule.enableLatestRenderer();
|
|
376
342
|
};
|
|
377
343
|
exports.enableLatestRenderer = enableLatestRenderer;
|
|
378
|
-
|
|
344
|
+
function mapViewModuleMethod(name) {
|
|
345
|
+
if (!NativeMapViewModule_1.default) {
|
|
346
|
+
throw new Error('MapViewModule is null');
|
|
347
|
+
}
|
|
348
|
+
const method = NativeMapViewModule_1.default[name];
|
|
349
|
+
if (!method) {
|
|
350
|
+
throw new Error(`Method ${name} is not defined`);
|
|
351
|
+
}
|
|
352
|
+
return NativeMapViewModule_1.default[name];
|
|
353
|
+
}
|
|
354
|
+
function googleMapViewModuleMethod(name) {
|
|
355
|
+
if (!NativeGoogleMapViewModule_1.default) {
|
|
356
|
+
throw new Error('GoogleMapViewModule is null');
|
|
357
|
+
}
|
|
358
|
+
const method = NativeGoogleMapViewModule_1.default[name];
|
|
359
|
+
if (!method) {
|
|
360
|
+
throw new Error(`Method ${name} is not defined`);
|
|
361
|
+
}
|
|
362
|
+
return NativeGoogleMapViewModule_1.default[name];
|
|
363
|
+
}
|
|
379
364
|
exports.default = MapView;
|
package/lib/MapView.types.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { ClickEvent, LatLng, Point, Region } from './sharedTypes';
|
|
1
|
+
import { ClickEvent, Frame, LatLng, Point, Region } from './sharedTypes';
|
|
2
2
|
import { NativeSyntheticEvent } from 'react-native';
|
|
3
3
|
export type Camera = {
|
|
4
4
|
/**
|
|
@@ -119,7 +119,7 @@ export type ChangeEvent = NativeSyntheticEvent<{
|
|
|
119
119
|
}>;
|
|
120
120
|
export type FitToOptions = {
|
|
121
121
|
edgePadding?: EdgePadding;
|
|
122
|
-
|
|
122
|
+
duration?: number;
|
|
123
123
|
};
|
|
124
124
|
export type BoundingBox = {
|
|
125
125
|
northEast: LatLng;
|
|
@@ -150,4 +150,9 @@ export type Address = {
|
|
|
150
150
|
subLocality: string;
|
|
151
151
|
thoroughfare: string;
|
|
152
152
|
};
|
|
153
|
-
export
|
|
153
|
+
export interface MarkersFrames {
|
|
154
|
+
[key: string]: {
|
|
155
|
+
point: Point;
|
|
156
|
+
frame: Frame;
|
|
157
|
+
};
|
|
158
|
+
}
|