react-native-maps 2.0.0-beta.10 → 2.0.0-beta.11
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 +3 -20
- package/android/src/main/java/com/rnmaps/maps/MapView.java +0 -13
- package/ios/GoogleMaps/RNMGoogleMap.m +9 -0
- package/ios/GoogleMaps/RNMGoogleMapManager.m +1 -34
- package/ios/GoogleMaps/RNMGoogleMapViewModule.m +12 -7
- package/ios/Maps/RNMMapManager.m +0 -24
- package/ios/Maps/RNMMapViewModule.m +10 -4
- package/lib/MapView.d.ts +7 -2
- package/lib/MapView.js +0 -11
- package/lib/MapViewNativeComponent.d.ts +0 -8
- package/lib/MapViewNativeComponent.js +0 -8
- package/package.json +1 -1
|
@@ -279,26 +279,9 @@ public class MapManager extends ViewGroupManager<MapView> {
|
|
|
279
279
|
view.setBoundary(boundary);
|
|
280
280
|
}
|
|
281
281
|
|
|
282
|
-
@
|
|
283
|
-
public void
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
switch (commandId) {
|
|
287
|
-
case "setCamera":
|
|
288
|
-
if(args == null) {
|
|
289
|
-
break;
|
|
290
|
-
}
|
|
291
|
-
camera = args.getMap(0);
|
|
292
|
-
view.animateToCamera(camera, 0);
|
|
293
|
-
break;
|
|
294
|
-
|
|
295
|
-
case "setIndoorActiveLevelIndex":
|
|
296
|
-
if(args == null) {
|
|
297
|
-
break;
|
|
298
|
-
}
|
|
299
|
-
view.setIndoorActiveLevelIndex(args.getInt(0));
|
|
300
|
-
break;
|
|
301
|
-
}
|
|
282
|
+
@ReactProp(name = "indoorActiveLevelIndex")
|
|
283
|
+
public void setIndoorActiveLevelIndex(MapView view, int index) {
|
|
284
|
+
view.setIndoorActiveLevelIndex(index);
|
|
302
285
|
}
|
|
303
286
|
|
|
304
287
|
@Override
|
|
@@ -886,19 +886,6 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
|
|
|
886
886
|
return CameraUpdateFactory.newCameraPosition(builder.build());
|
|
887
887
|
}
|
|
888
888
|
|
|
889
|
-
public void animateToCamera(ReadableMap camera, int duration) {
|
|
890
|
-
if (map == null) return;
|
|
891
|
-
|
|
892
|
-
CameraUpdate update = buildCameraUpdate(camera);
|
|
893
|
-
|
|
894
|
-
if (duration <= 0) {
|
|
895
|
-
map.moveCamera(update);
|
|
896
|
-
}
|
|
897
|
-
else {
|
|
898
|
-
map.animateCamera(update, duration, null);
|
|
899
|
-
}
|
|
900
|
-
}
|
|
901
|
-
|
|
902
889
|
public int baseLeftMapPadding;
|
|
903
890
|
public int baseRightMapPadding;
|
|
904
891
|
public int baseTopMapPadding;
|
|
@@ -309,6 +309,15 @@ id regionAsJSON(MKCoordinateRegion region) {
|
|
|
309
309
|
self.cameraTargetBounds = boundary;
|
|
310
310
|
}
|
|
311
311
|
|
|
312
|
+
- (void)setIndoorActiveLevelIndex:(NSInteger)index {
|
|
313
|
+
if (!self.indoorDisplay) {
|
|
314
|
+
return;
|
|
315
|
+
}
|
|
316
|
+
if ( index < [self.indoorDisplay.activeBuilding.levels count]) {
|
|
317
|
+
self.indoorDisplay.activeLevel = self.indoorDisplay.activeBuilding.levels[index];
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
|
|
312
321
|
- (void)didPrepareMap {
|
|
313
322
|
UIView* mapView = [self valueForKey:@"mapView"]; //GMSVectorMapView
|
|
314
323
|
[self overrideGestureRecognizersForView:mapView];
|
|
@@ -67,6 +67,7 @@ RCT_EXPORT_MODULE(RNMGoogleMap)
|
|
|
67
67
|
|
|
68
68
|
RCT_EXPORT_VIEW_PROPERTY(boundary, GMSCoordinateBounds*)
|
|
69
69
|
RCT_EXPORT_VIEW_PROPERTY(customMapStyleString, NSString)
|
|
70
|
+
RCT_EXPORT_VIEW_PROPERTY(indoorActiveLevelIndex, NSInteger)
|
|
70
71
|
RCT_EXPORT_VIEW_PROPERTY(initialCamera, GMSCameraPosition)
|
|
71
72
|
RCT_EXPORT_VIEW_PROPERTY(initialRegion, MKCoordinateRegion)
|
|
72
73
|
RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
|
|
@@ -107,40 +108,6 @@ RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, GMSCameraPosition)
|
|
|
107
108
|
RCT_REMAP_VIEW_PROPERTY(paddingAdjustmentBehavior, paddingAdjustmentBehaviorString, NSString)
|
|
108
109
|
RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
|
|
109
110
|
|
|
110
|
-
RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
|
|
111
|
-
camera:(id)json)
|
|
112
|
-
{
|
|
113
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
114
|
-
id view = viewRegistry[reactTag];
|
|
115
|
-
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
116
|
-
RCTLogError(@"Invalid view returned from registry, expecting RNMGoogleMap, got: %@", view);
|
|
117
|
-
} else {
|
|
118
|
-
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
119
|
-
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView camera]];
|
|
120
|
-
[mapView setCamera:camera];
|
|
121
|
-
}
|
|
122
|
-
}];
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
RCT_EXPORT_METHOD(setIndoorActiveLevelIndex:(nonnull NSNumber *)reactTag
|
|
126
|
-
levelIndex:(NSInteger) levelIndex)
|
|
127
|
-
{
|
|
128
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
129
|
-
id view = viewRegistry[reactTag];
|
|
130
|
-
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
131
|
-
RCTLogError(@"Invalid view returned from registry, expecting RNMGoogleMap, got: %@", view);
|
|
132
|
-
} else {
|
|
133
|
-
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
134
|
-
if (!mapView.indoorDisplay) {
|
|
135
|
-
return;
|
|
136
|
-
}
|
|
137
|
-
if ( levelIndex < [mapView.indoorDisplay.activeBuilding.levels count]) {
|
|
138
|
-
mapView.indoorDisplay.activeLevel = mapView.indoorDisplay.activeBuilding.levels[levelIndex];
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
}];
|
|
142
|
-
}
|
|
143
|
-
|
|
144
111
|
+ (BOOL)requiresMainQueueSetup {
|
|
145
112
|
return YES;
|
|
146
113
|
}
|
|
@@ -224,13 +224,18 @@ RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
|
224
224
|
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
225
225
|
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView camera]];
|
|
226
226
|
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
227
|
+
if(duration > 0.0f) {
|
|
228
|
+
[CATransaction begin];
|
|
229
|
+
[CATransaction setCompletionBlock:^{
|
|
230
|
+
resolve(nil);
|
|
231
|
+
}];
|
|
232
|
+
[CATransaction setAnimationDuration:duration/1000];
|
|
233
|
+
[mapView animateToCameraPosition:camera];
|
|
234
|
+
[CATransaction commit];
|
|
235
|
+
} else {
|
|
236
|
+
[mapView moveCamera:camera];
|
|
237
|
+
resolve(nil);
|
|
238
|
+
}
|
|
234
239
|
}
|
|
235
240
|
}];
|
|
236
241
|
}
|
package/ios/Maps/RNMMapManager.m
CHANGED
|
@@ -170,30 +170,6 @@ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RNMMap)
|
|
|
170
170
|
view.ignoreRegionChanges = originalIgnore;
|
|
171
171
|
}
|
|
172
172
|
|
|
173
|
-
#pragma mark exported MapView methods
|
|
174
|
-
|
|
175
|
-
RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
|
|
176
|
-
camera:(id)json)
|
|
177
|
-
{
|
|
178
|
-
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
179
|
-
id view = viewRegistry[reactTag];
|
|
180
|
-
if (![view isKindOfClass:[RNMMap class]]) {
|
|
181
|
-
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
182
|
-
} else {
|
|
183
|
-
RNMMap *mapView = (RNMMap *)view;
|
|
184
|
-
|
|
185
|
-
// Merge the changes given with the current camera
|
|
186
|
-
MKMapCamera *camera = [RCTConvert MKMapCameraWithDefaults:json existingCamera:[mapView camera]];
|
|
187
|
-
|
|
188
|
-
// don't emit region change events when we are setting the camera
|
|
189
|
-
BOOL originalIgnore = mapView.ignoreRegionChanges;
|
|
190
|
-
mapView.ignoreRegionChanges = YES;
|
|
191
|
-
[mapView setCamera:camera animated:NO];
|
|
192
|
-
mapView.ignoreRegionChanges = originalIgnore;
|
|
193
|
-
}
|
|
194
|
-
}];
|
|
195
|
-
}
|
|
196
|
-
|
|
197
173
|
#pragma mark Gesture Recognizer Handlers
|
|
198
174
|
|
|
199
175
|
#define MAX_DISTANCE_PX 10.0f
|
|
@@ -259,12 +259,18 @@ RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
|
259
259
|
// don't emit region change events when we are setting the camera
|
|
260
260
|
BOOL originalIgnore = mapView.ignoreRegionChanges;
|
|
261
261
|
mapView.ignoreRegionChanges = YES;
|
|
262
|
-
|
|
263
|
-
[
|
|
264
|
-
|
|
262
|
+
if(duration > 0.0f) {
|
|
263
|
+
[RNMMap animateWithDuration:duration/1000 animations:^{
|
|
264
|
+
[mapView setCamera:camera animated:YES];
|
|
265
|
+
} completion:^(BOOL finished){
|
|
266
|
+
mapView.ignoreRegionChanges = originalIgnore;
|
|
267
|
+
resolve(nil);
|
|
268
|
+
}];
|
|
269
|
+
} else {
|
|
270
|
+
[mapView setCamera:camera animated:NO];
|
|
265
271
|
mapView.ignoreRegionChanges = originalIgnore;
|
|
266
272
|
resolve(nil);
|
|
267
|
-
}
|
|
273
|
+
}
|
|
268
274
|
}
|
|
269
275
|
}];
|
|
270
276
|
}
|
package/lib/MapView.d.ts
CHANGED
|
@@ -53,6 +53,13 @@ export type MapViewProps = ViewProps & {
|
|
|
53
53
|
* @platform Android: Not supported
|
|
54
54
|
*/
|
|
55
55
|
followsUserLocation?: boolean;
|
|
56
|
+
/**
|
|
57
|
+
* Set to control what indoor building level to display.
|
|
58
|
+
*
|
|
59
|
+
* @platform iOS: Google Maps only
|
|
60
|
+
* @platform Android: Supported
|
|
61
|
+
*/
|
|
62
|
+
indoorActiveLevelIndex?: number;
|
|
56
63
|
/**
|
|
57
64
|
* The initial camera view the map should use. Use this prop instead of `camera`
|
|
58
65
|
* only if you don't want to control the camera of the map besides the initial view.
|
|
@@ -586,7 +593,6 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
586
593
|
private _onMapReady;
|
|
587
594
|
private _onChange;
|
|
588
595
|
getCamera(): Promise<Camera>;
|
|
589
|
-
setCamera(camera: Partial<Camera>): void;
|
|
590
596
|
animateCamera(camera: Partial<Camera>, duration?: number): Promise<void>;
|
|
591
597
|
animateToRegion(region: Region, duration?: number): Promise<void>;
|
|
592
598
|
fitToElements(options?: FitToOptions): Promise<void>;
|
|
@@ -598,7 +604,6 @@ declare class MapView extends React.Component<MapViewProps, State> {
|
|
|
598
604
|
* @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
|
|
599
605
|
*/
|
|
600
606
|
getMapBoundaries(): Promise<BoundingBox>;
|
|
601
|
-
setIndoorActiveLevelIndex(activeLevelIndex: number): void;
|
|
602
607
|
/**
|
|
603
608
|
* Takes a snapshot of the map and saves it to a picture
|
|
604
609
|
* file or returns the image as a base64 encoded string.
|
package/lib/MapView.js
CHANGED
|
@@ -31,7 +31,6 @@ const React = __importStar(require("react"));
|
|
|
31
31
|
const react_native_1 = require("react-native");
|
|
32
32
|
const decorateMapComponent_1 = require("./decorateMapComponent");
|
|
33
33
|
const ProviderConstants = __importStar(require("./ProviderConstants"));
|
|
34
|
-
const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
|
|
35
34
|
const NativeMapViewModule_1 = __importDefault(require("./NativeMapViewModule"));
|
|
36
35
|
const NativeGoogleMapViewModule_1 = __importDefault(require("./NativeGoogleMapViewModule"));
|
|
37
36
|
exports.MAP_TYPES = {
|
|
@@ -89,11 +88,6 @@ class MapView extends React.Component {
|
|
|
89
88
|
}
|
|
90
89
|
return mapViewModuleMethod('getCamera')(this._getHandle());
|
|
91
90
|
}
|
|
92
|
-
setCamera(camera) {
|
|
93
|
-
if (this.map.current) {
|
|
94
|
-
MapViewNativeComponent_1.Commands.setCamera(this.map.current, camera);
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
91
|
animateCamera(camera, duration = 500) {
|
|
98
92
|
if (this._gogleMapsOniOS()) {
|
|
99
93
|
return googleMapViewModuleMethod('animateCamera')(this._getHandle(), camera, duration);
|
|
@@ -138,11 +132,6 @@ class MapView extends React.Component {
|
|
|
138
132
|
}
|
|
139
133
|
return mapViewModuleMethod('getMapBoundaries')(this._getHandle());
|
|
140
134
|
}
|
|
141
|
-
setIndoorActiveLevelIndex(activeLevelIndex) {
|
|
142
|
-
if (this.map.current) {
|
|
143
|
-
MapViewNativeComponent_1.Commands.setIndoorActiveLevelIndex(this.map.current, activeLevelIndex);
|
|
144
|
-
}
|
|
145
|
-
}
|
|
146
135
|
/**
|
|
147
136
|
* Takes a snapshot of the map and saves it to a picture
|
|
148
137
|
* file or returns the image as a base64 encoded string.
|
|
@@ -1,11 +1,3 @@
|
|
|
1
|
-
/// <reference types="react" />
|
|
2
1
|
import type { HostComponent } from 'react-native';
|
|
3
2
|
import { NativeProps } from './MapView';
|
|
4
|
-
import { Camera } from './MapView.types';
|
|
5
3
|
export type MapViewNativeComponentType = HostComponent<NativeProps>;
|
|
6
|
-
interface NativeCommands {
|
|
7
|
-
setCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>) => void;
|
|
8
|
-
setIndoorActiveLevelIndex: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, activeLevelIndex: number) => void;
|
|
9
|
-
}
|
|
10
|
-
export declare const Commands: NativeCommands;
|
|
11
|
-
export {};
|
|
@@ -1,10 +1,2 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.Commands = void 0;
|
|
7
|
-
const codegenNativeCommands_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
|
|
8
|
-
exports.Commands = (0, codegenNativeCommands_1.default)({
|
|
9
|
-
supportedCommands: ['setCamera', 'setIndoorActiveLevelIndex'],
|
|
10
|
-
});
|
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": "2.0.0-beta.
|
|
8
|
+
"version": "2.0.0-beta.11",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|