Skip to content

Commit a041572

Browse files
fix(google-maps): map type missing (#309)
* Fix/google maps ground overlay (#303) * fixes android ground overlay from position * adds ground overlay from bounds * fixes map style * add iOS map type Co-authored-by: tomma_g <38555316+tommag21@users.noreply.github.com>
1 parent 535d95f commit a041572

File tree

2 files changed

+40
-2
lines changed

2 files changed

+40
-2
lines changed

packages/google-maps/index.d.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { Color, ImageSource, EventData, View } from '@nativescript/core';
2-
import { JointType, MapViewBase } from './common';
2+
import { JointType, MapType, MapViewBase } from './common';
33

44
export type FeatureTypeAdministrative = 'administrative' | 'administrative.country' | 'administrative.land_parcel' | 'administrative.locality' | 'administrative.neighborhood' | 'administrative.province';
55

@@ -380,6 +380,8 @@ export interface IGoogleMap {
380380

381381
mapStyle: Style[];
382382

383+
mapType: MapType;
384+
383385
snapshot(): Promise<ImageSource>;
384386

385387
animateCamera(update: CameraUpdate);
@@ -413,6 +415,7 @@ export interface IGoogleMap {
413415

414416
export class GoogleMap implements IGoogleMap {
415417
mapStyle: Style[];
418+
mapType: MapType;
416419
addTileOverlay(options: TileOverlayOptions): TileOverlay;
417420
removeTileOverlay(overlay: TileOverlay);
418421
buildingsEnabled: boolean;

packages/google-maps/index.ios.ts

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import { Color, EventData, ImageSource, Utils, View } from '@nativescript/core';
22
import { isNullOrUndefined } from '@nativescript/core/utils/types';
33
import { ActiveBuildingEvent, ActiveLevelEvent, CameraPositionEvent, CameraPositionStartEvent, CircleOptions, Coordinate, CoordinateBounds, GroundOverlayOptions, GroundOverlayTapEvent, ICameraPosition, ICameraUpdate, ICircle, IGoogleMap, IGroundOverlay, IIndoorBuilding, IIndoorLevel, IMarker, InfoWindowEvent, IPatternItem, IPoi, IPolygon, IPolyline, IProjection, ITileOverlay, ITileProvider, IUISettings, IVisibleRegion, MapTapEvent, MarkerDragEvent, MarkerInfoEvent, MarkerOptions, MarkerTapEvent, PoiTapEvent, PolygonOptions, PolylineOptions, Style, TileOverlayOptions } from '.';
4-
import { bearingProperty, JointType, latProperty, lngProperty, MapViewBase, tiltProperty, zoomProperty } from './common';
4+
import { bearingProperty, JointType, latProperty, lngProperty, MapType, MapViewBase, tiltProperty, zoomProperty } from './common';
55
import { deserialize, intoNativeCircleOptions, intoNativeGroundOverlayOptions, intoNativeMarkerOptions, intoNativePolygonOptions, intoNativePolylineOptions, serialize } from './utils';
66

77
export class CameraUpdate implements ICameraUpdate {
@@ -820,6 +820,41 @@ export class GoogleMap implements IGoogleMap {
820820
return UISettings.fromNative(this.native.settings);
821821
}
822822

823+
get mapType() {
824+
switch (this.native.mapType) {
825+
case GMSMapViewType.kGMSTypeNone:
826+
return MapType.None;
827+
case GMSMapViewType.kGMSTypeNormal:
828+
return MapType.Normal;
829+
case GMSMapViewType.kGMSTypeSatellite:
830+
return MapType.Satellite;
831+
case GMSMapViewType.kGMSTypeTerrain:
832+
return MapType.Terrain;
833+
case GMSMapViewType.kGMSTypeHybrid:
834+
return MapType.Hybrid;
835+
}
836+
}
837+
838+
set mapType(value: MapType) {
839+
switch (value) {
840+
case MapType.None:
841+
this.native.mapType = GMSMapViewType.kGMSTypeNone;
842+
break;
843+
case MapType.Normal:
844+
this.native.mapType = GMSMapViewType.kGMSTypeNormal;
845+
break;
846+
case MapType.Satellite:
847+
this.native.mapType = GMSMapViewType.kGMSTypeSatellite;
848+
break;
849+
case MapType.Terrain:
850+
this.native.mapType = GMSMapViewType.kGMSTypeTerrain;
851+
break;
852+
case MapType.Hybrid:
853+
this.native.mapType = GMSMapViewType.kGMSTypeHybrid;
854+
break;
855+
}
856+
}
857+
823858
#mapStyle: Style[];
824859
get mapStyle() {
825860
return this.#mapStyle;

0 commit comments

Comments
 (0)