react-native-maps 1.12.0 → 1.13.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.
- package/android/src/main/java/com/rnmaps/maps/MapManager.java +447 -420
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +294 -292
- package/android/src/main/java/com/rnmaps/maps/MapModule.java +1 -27
- package/android/src/main/java/com/rnmaps/maps/MapView.java +33 -44
- package/lib/MapView.d.ts +8 -1
- package/lib/MapView.js +3 -8
- package/lib/index.d.ts +2 -2
- package/lib/index.js +1 -2
- package/package.json +1 -1
|
@@ -1,16 +1,14 @@
|
|
|
1
1
|
package com.rnmaps.maps;
|
|
2
2
|
|
|
3
|
+
import static androidx.core.content.PermissionChecker.checkSelfPermission;
|
|
4
|
+
|
|
3
5
|
import android.content.Context;
|
|
4
6
|
import android.content.res.ColorStateList;
|
|
5
7
|
import android.graphics.Bitmap;
|
|
6
8
|
import android.graphics.Color;
|
|
7
9
|
import android.graphics.Point;
|
|
8
|
-
|
|
9
|
-
import
|
|
10
|
-
import androidx.annotation.Nullable;
|
|
11
|
-
import androidx.core.content.PermissionChecker;
|
|
12
|
-
import androidx.core.view.GestureDetectorCompat;
|
|
13
|
-
import androidx.core.view.MotionEventCompat;
|
|
10
|
+
import android.location.Location;
|
|
11
|
+
import android.util.Log;
|
|
14
12
|
import android.view.GestureDetector;
|
|
15
13
|
import android.view.MotionEvent;
|
|
16
14
|
import android.view.View;
|
|
@@ -18,8 +16,14 @@ import android.view.ViewGroup;
|
|
|
18
16
|
import android.widget.ImageView;
|
|
19
17
|
import android.widget.ProgressBar;
|
|
20
18
|
import android.widget.RelativeLayout;
|
|
21
|
-
import android.location.Location;
|
|
22
19
|
|
|
20
|
+
import androidx.annotation.NonNull;
|
|
21
|
+
import androidx.annotation.Nullable;
|
|
22
|
+
import androidx.core.content.PermissionChecker;
|
|
23
|
+
import androidx.core.view.GestureDetectorCompat;
|
|
24
|
+
import androidx.core.view.MotionEventCompat;
|
|
25
|
+
|
|
26
|
+
import com.facebook.react.bridge.Arguments;
|
|
23
27
|
import com.facebook.react.bridge.LifecycleEventListener;
|
|
24
28
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
25
29
|
import com.facebook.react.bridge.ReadableArray;
|
|
@@ -28,21 +32,22 @@ import com.facebook.react.bridge.WritableArray;
|
|
|
28
32
|
import com.facebook.react.bridge.WritableMap;
|
|
29
33
|
import com.facebook.react.bridge.WritableNativeArray;
|
|
30
34
|
import com.facebook.react.bridge.WritableNativeMap;
|
|
31
|
-
import com.facebook.react.bridge.Arguments;
|
|
32
35
|
import com.facebook.react.uimanager.ThemedReactContext;
|
|
33
36
|
import com.facebook.react.uimanager.UIManagerHelper;
|
|
34
|
-
import com.facebook.react.uimanager.UIManagerModule;
|
|
35
37
|
import com.facebook.react.uimanager.common.UIManagerType;
|
|
36
38
|
import com.facebook.react.uimanager.events.EventDispatcher;
|
|
37
39
|
import com.google.android.gms.maps.CameraUpdate;
|
|
38
40
|
import com.google.android.gms.maps.CameraUpdateFactory;
|
|
39
41
|
import com.google.android.gms.maps.GoogleMap;
|
|
40
42
|
import com.google.android.gms.maps.GoogleMapOptions;
|
|
43
|
+
import com.google.android.gms.maps.MapsInitializer;
|
|
41
44
|
import com.google.android.gms.maps.OnMapReadyCallback;
|
|
42
45
|
import com.google.android.gms.maps.Projection;
|
|
43
46
|
import com.google.android.gms.maps.model.BitmapDescriptorFactory;
|
|
44
47
|
import com.google.android.gms.maps.model.CameraPosition;
|
|
45
48
|
import com.google.android.gms.maps.model.GroundOverlay;
|
|
49
|
+
import com.google.android.gms.maps.model.IndoorBuilding;
|
|
50
|
+
import com.google.android.gms.maps.model.IndoorLevel;
|
|
46
51
|
import com.google.android.gms.maps.model.LatLng;
|
|
47
52
|
import com.google.android.gms.maps.model.LatLngBounds;
|
|
48
53
|
import com.google.android.gms.maps.model.MapStyleOptions;
|
|
@@ -52,8 +57,6 @@ import com.google.android.gms.maps.model.PointOfInterest;
|
|
|
52
57
|
import com.google.android.gms.maps.model.Polygon;
|
|
53
58
|
import com.google.android.gms.maps.model.Polyline;
|
|
54
59
|
import com.google.android.gms.maps.model.TileOverlay;
|
|
55
|
-
import com.google.android.gms.maps.model.IndoorBuilding;
|
|
56
|
-
import com.google.android.gms.maps.model.IndoorLevel;
|
|
57
60
|
import com.google.maps.android.collections.CircleManager;
|
|
58
61
|
import com.google.maps.android.collections.GroundOverlayManager;
|
|
59
62
|
import com.google.maps.android.collections.MarkerManager;
|
|
@@ -75,8 +78,6 @@ import java.util.List;
|
|
|
75
78
|
import java.util.Map;
|
|
76
79
|
import java.util.concurrent.ExecutionException;
|
|
77
80
|
|
|
78
|
-
import static androidx.core.content.PermissionChecker.checkSelfPermission;
|
|
79
|
-
|
|
80
81
|
public class MapView extends com.google.android.gms.maps.MapView implements GoogleMap.InfoWindowAdapter,
|
|
81
82
|
GoogleMap.OnMarkerDragListener, OnMapReadyCallback, GoogleMap.OnPoiClickListener, GoogleMap.OnIndoorStateChangeListener {
|
|
82
83
|
public GoogleMap map;
|
|
@@ -104,12 +105,10 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
104
105
|
private boolean moveOnMarkerPress = true;
|
|
105
106
|
private boolean cacheEnabled = false;
|
|
106
107
|
private ReadableMap initialRegion;
|
|
107
|
-
private ReadableMap initialCamera;
|
|
108
108
|
private ReadableMap region;
|
|
109
109
|
private ReadableMap camera;
|
|
110
110
|
private String customMapStyleString;
|
|
111
111
|
private boolean initialRegionSet = false;
|
|
112
|
-
private boolean initialCameraSet = false;
|
|
113
112
|
private LatLngBounds cameraLastIdleBounds;
|
|
114
113
|
private int cameraMoveReason = 0;
|
|
115
114
|
private MapMarker selectedMarker;
|
|
@@ -173,9 +172,8 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
173
172
|
|
|
174
173
|
this.manager = manager;
|
|
175
174
|
this.context = reactContext;
|
|
176
|
-
|
|
175
|
+
MapsInitializer.initialize(context, this.manager.renderer, renderer -> Log.d("AirMapRenderer", renderer.toString()));
|
|
177
176
|
super.onCreate(null);
|
|
178
|
-
// TODO(lmr): what about onStart????
|
|
179
177
|
super.onResume();
|
|
180
178
|
super.getMapAsync(this);
|
|
181
179
|
|
|
@@ -538,23 +536,10 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
538
536
|
}
|
|
539
537
|
}
|
|
540
538
|
|
|
541
|
-
public void setInitialCamera(ReadableMap initialCamera) {
|
|
542
|
-
this.initialCamera = initialCamera;
|
|
543
|
-
// Theoretically onMapReady might be called before setInitialCamera
|
|
544
|
-
// In that case, trigger moveToCamera manually
|
|
545
|
-
if (!initialCameraSet && map != null) {
|
|
546
|
-
moveToCamera(initialCamera);
|
|
547
|
-
initialCameraSet = true;
|
|
548
|
-
}
|
|
549
|
-
}
|
|
550
|
-
|
|
551
539
|
private void applyBridgedProps() {
|
|
552
540
|
if(initialRegion != null) {
|
|
553
541
|
moveToRegion(initialRegion);
|
|
554
542
|
initialRegionSet = true;
|
|
555
|
-
} else if(initialCamera != null) {
|
|
556
|
-
moveToCamera(initialCamera);
|
|
557
|
-
initialCameraSet = true;
|
|
558
543
|
} else if(region != null) {
|
|
559
544
|
moveToRegion(region);
|
|
560
545
|
} else {
|
|
@@ -602,24 +587,28 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
602
587
|
moveToCamera(camera);
|
|
603
588
|
}
|
|
604
589
|
}
|
|
590
|
+
public static CameraPosition cameraPositionFromMap(ReadableMap camera){
|
|
591
|
+
if (camera == null) return null;
|
|
605
592
|
|
|
606
|
-
|
|
607
|
-
if (camera == null) return;
|
|
608
|
-
|
|
609
|
-
CameraPosition.Builder builder = new CameraPosition.Builder();
|
|
593
|
+
CameraPosition.Builder builder = new CameraPosition.Builder();
|
|
610
594
|
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
595
|
+
ReadableMap center = camera.getMap("center");
|
|
596
|
+
if (center != null) {
|
|
597
|
+
double lng = center.getDouble("longitude");
|
|
598
|
+
double lat = center.getDouble("latitude");
|
|
599
|
+
builder.target(new LatLng(lat, lng));
|
|
600
|
+
}
|
|
617
601
|
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
602
|
+
builder.tilt((float)camera.getDouble("pitch"));
|
|
603
|
+
builder.bearing((float)camera.getDouble("heading"));
|
|
604
|
+
builder.zoom((float)camera.getDouble("zoom"));
|
|
621
605
|
|
|
622
|
-
|
|
606
|
+
return builder.build();
|
|
607
|
+
}
|
|
608
|
+
public void moveToCamera(ReadableMap cameraMap) {
|
|
609
|
+
CameraPosition camera = cameraPositionFromMap(cameraMap);
|
|
610
|
+
if (camera == null) return;
|
|
611
|
+
CameraUpdate update = CameraUpdateFactory.newCameraPosition(camera);
|
|
623
612
|
|
|
624
613
|
if (super.getHeight() <= 0 || super.getWidth() <= 0) {
|
|
625
614
|
// in this case, our map has not been laid out yet, so we save the camera update in a
|
package/lib/MapView.d.ts
CHANGED
|
@@ -101,6 +101,14 @@ export type MapViewProps = ViewProps & {
|
|
|
101
101
|
* google cloud mapId to enable cloud styling and more
|
|
102
102
|
*/
|
|
103
103
|
googleMapId?: string;
|
|
104
|
+
/**
|
|
105
|
+
* https://developers.google.com/maps/documentation/android-sdk/renderer
|
|
106
|
+
* google maps renderer
|
|
107
|
+
* @default `LATEST`
|
|
108
|
+
* @platform iOS: Not supported
|
|
109
|
+
* @platform Android: Supported
|
|
110
|
+
*/
|
|
111
|
+
googleRenderer?: 'LATEST' | 'LEGACY';
|
|
104
112
|
/**
|
|
105
113
|
* Sets loading background color.
|
|
106
114
|
*
|
|
@@ -682,5 +690,4 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
682
690
|
render(): React.JSX.Element;
|
|
683
691
|
}
|
|
684
692
|
export declare const AnimatedMapView: RNAnimated.AnimatedComponent<typeof MapView>;
|
|
685
|
-
export declare const enableLatestRenderer: () => any;
|
|
686
693
|
export default MapView;
|
package/lib/MapView.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.
|
|
26
|
+
exports.AnimatedMapView = exports.MAP_TYPES = void 0;
|
|
27
27
|
const React = __importStar(require("react"));
|
|
28
28
|
const react_native_1 = require("react-native");
|
|
29
29
|
const decorateMapComponent_1 = require("./decorateMapComponent");
|
|
@@ -308,6 +308,7 @@ class MapView extends React.Component {
|
|
|
308
308
|
onMapReady: this._onMapReady,
|
|
309
309
|
liteMode: this.props.liteMode,
|
|
310
310
|
googleMapId: this.props.googleMapId,
|
|
311
|
+
googleRenderer: this.props.googleRenderer,
|
|
311
312
|
ref: this.map,
|
|
312
313
|
customMapStyleString: this.props.customMapStyle
|
|
313
314
|
? JSON.stringify(this.props.customMapStyle)
|
|
@@ -330,6 +331,7 @@ class MapView extends React.Component {
|
|
|
330
331
|
region: null,
|
|
331
332
|
liteMode: this.props.liteMode,
|
|
332
333
|
googleMapId: this.props.googleMapId,
|
|
334
|
+
googleRenderer: this.props.googleRenderer,
|
|
333
335
|
initialRegion: this.props.initialRegion || null,
|
|
334
336
|
initialCamera: this.props.initialCamera,
|
|
335
337
|
ref: this.map,
|
|
@@ -361,12 +363,5 @@ else {
|
|
|
361
363
|
}
|
|
362
364
|
const getNativeMapComponent = (provider) => airMaps[provider || 'default'];
|
|
363
365
|
exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
|
|
364
|
-
const enableLatestRenderer = () => {
|
|
365
|
-
if (react_native_1.Platform.OS !== 'android') {
|
|
366
|
-
return;
|
|
367
|
-
}
|
|
368
|
-
return react_native_1.NativeModules.AirMapModule.enableLatestRenderer();
|
|
369
|
-
};
|
|
370
|
-
exports.enableLatestRenderer = enableLatestRenderer;
|
|
371
366
|
MapView.Animated = exports.AnimatedMapView;
|
|
372
367
|
exports.default = MapView;
|
package/lib/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import MapView, { AnimatedMapView as Animated, MAP_TYPES,
|
|
1
|
+
import MapView, { AnimatedMapView as Animated, MAP_TYPES, MapViewProps } from './MapView';
|
|
2
2
|
import Marker from './MapMarker';
|
|
3
3
|
export { MapMarker } from './MapMarker';
|
|
4
4
|
export type { MapMarkerProps } from './MapMarker';
|
|
@@ -28,7 +28,7 @@ export { default as Geojson } from './Geojson';
|
|
|
28
28
|
export type { GeojsonProps } from './Geojson';
|
|
29
29
|
export { Marker, Overlay };
|
|
30
30
|
export type { MapViewProps };
|
|
31
|
-
export { Animated, MAP_TYPES
|
|
31
|
+
export { Animated, MAP_TYPES };
|
|
32
32
|
export * from './ProviderConstants';
|
|
33
33
|
export * from './MapView.types';
|
|
34
34
|
export * from './MapPolygon.types';
|
package/lib/index.js
CHANGED
|
@@ -29,11 +29,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
29
29
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
30
30
|
};
|
|
31
31
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
32
|
-
exports.OverlayAnimated = exports.MarkerAnimated = exports.
|
|
32
|
+
exports.OverlayAnimated = exports.MarkerAnimated = exports.MAP_TYPES = exports.Animated = exports.Overlay = exports.Marker = exports.Geojson = exports.AnimatedRegion = exports.MapCalloutSubview = exports.CalloutSubview = exports.MapCallout = exports.Callout = exports.MapLocalTile = exports.LocalTile = exports.MapWMSTile = exports.WMSTile = exports.MapUrlTile = exports.UrlTile = exports.MapCircle = exports.Circle = exports.MapPolygon = exports.Polygon = exports.MapHeatmap = exports.Heatmap = exports.MapPolyline = exports.Polyline = exports.MapOverlay = exports.MapMarker = void 0;
|
|
33
33
|
const MapView_1 = __importStar(require("./MapView"));
|
|
34
34
|
Object.defineProperty(exports, "Animated", { enumerable: true, get: function () { return MapView_1.AnimatedMapView; } });
|
|
35
35
|
Object.defineProperty(exports, "MAP_TYPES", { enumerable: true, get: function () { return MapView_1.MAP_TYPES; } });
|
|
36
|
-
Object.defineProperty(exports, "enableLatestRenderer", { enumerable: true, get: function () { return MapView_1.enableLatestRenderer; } });
|
|
37
36
|
const MapMarker_1 = __importDefault(require("./MapMarker"));
|
|
38
37
|
exports.Marker = MapMarker_1.default;
|
|
39
38
|
var MapMarker_2 = require("./MapMarker");
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "1.
|
|
8
|
+
"version": "1.13.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|