react-native-maps 1.21.0-alpha.98 → 1.21.0
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 +9 -4
- package/android/build.gradle +65 -72
- package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
- package/android/src/main/RCTAppDependencyProvider.h +25 -0
- package/android/src/main/RCTAppDependencyProvider.mm +55 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/android/src/main/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.h +16 -0
- package/android/src/main/RCTThirdPartyComponentsProvider.mm +28 -0
- package/android/src/main/ReactAppDependencyProvider.podspec +34 -0
- package/android/src/main/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +209 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +74 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +45 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +22 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerDelegate.java +62 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerInterface.java +27 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerDelegate.java +56 -0
- package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +25 -0
- package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +5 -1
- package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +1 -1
- package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +9 -3
- package/android/src/main/java/com/rnmaps/fabric/UrlTileManager.java +124 -0
- package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -0
- package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +19 -3
- package/android/src/main/java/com/rnmaps/maps/MapMarker.java +608 -603
- package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +2 -22
- package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +23 -1
- package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +18 -18
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +10 -14
- package/android/src/main/java/com/rnmaps/maps/MapView.java +58 -49
- package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +3 -3
- package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +10 -10
- package/android/src/main/jni/CMakeLists.txt +36 -0
- package/android/src/main/jni/RNMapsSpecs-generated.cpp +68 -0
- package/android/src/main/jni/RNMapsSpecs.h +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +31 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +33 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +979 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +860 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +227 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +1297 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +26 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +131 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
- package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +137 -0
- package/ios/AirGoogleMaps/AIRGoogleMap.h +13 -13
- package/ios/AirGoogleMaps/{AIRGoogleMap.m → AIRGoogleMap.mm} +32 -34
- package/ios/AirGoogleMaps/AIRGoogleMapManager.h +1 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.mm +543 -0
- package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +3 -3
- package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
- package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +5 -2
- package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +41 -33
- package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
- package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +23 -14
- package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +1 -0
- package/ios/AirMaps/AIRMap.h +8 -9
- package/ios/AirMaps/{AIRMap.m → AIRMap.mm} +18 -14
- package/ios/AirMaps/AIRMapManager.m +8 -19
- package/ios/AirMaps/AIRMapMarker.m +57 -44
- package/ios/AirMaps/AIRMapOverlay.m +2 -2
- package/ios/AirMaps/AIRMapWMSTile.m +8 -8
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +77 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
- package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +51 -0
- package/ios/AirMaps/RNMapsAirModule.h +2 -3
- package/ios/AirMaps/RNMapsAirModule.mm +14 -0
- package/ios/AirMaps/RNMapsDefines.h +1 -0
- package/ios/AirMaps/RNMapsMapView.h +5 -2
- package/ios/AirMaps/RNMapsMapView.mm +16 -6
- package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
- package/ios/AirMaps/RNMapsMarkerView.mm +12 -4
- package/ios/AirMaps/RNMapsMarkerViewManager.mm +7 -0
- package/ios/AirMaps/module.modulemap +6 -0
- package/ios/AirMaps.xcodeproj/project.pbxproj +15 -55
- package/ios/generated/RCTAppDependencyProvider.h +25 -0
- package/ios/generated/RCTAppDependencyProvider.mm +55 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
- package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
- package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
- package/ios/{AirMaps → generated}/RNMapsAirModuleDelegate.h +1 -1
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
- package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +31 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.cpp +977 -0
- package/ios/generated/RNMapsSpecs/EventEmitters.h +846 -0
- package/ios/generated/RNMapsSpecs/Props.cpp +194 -0
- package/ios/generated/RNMapsSpecs/Props.h +1224 -0
- package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +591 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
- package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +24 -0
- package/ios/generated/RNMapsSpecs/ShadowNodes.h +109 -0
- package/ios/generated/RNMapsSpecs/States.cpp +16 -0
- package/ios/generated/RNMapsSpecs/States.h +113 -0
- package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
- package/ios/generated/RNMapsSpecsJSI.h +268 -0
- package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
- package/ios/generated/module.modulemap +15 -0
- package/package.json +30 -25
- package/react-native-google-maps.podspec +27 -0
- package/react-native-maps-generated.podspec +31 -0
- package/react-native-maps.podspec +52 -46
- package/react-native.config.js +16 -0
- package/src/AnimatedRegion.ts +169 -0
- package/src/Geojson.tsx +541 -0
- package/src/MapCallout.tsx +77 -0
- package/src/MapCalloutSubview.tsx +64 -0
- package/src/MapCircle.tsx +162 -0
- package/src/MapHeatmap.tsx +125 -0
- package/src/MapLocalTile.tsx +60 -0
- package/src/MapMarker.tsx +531 -0
- package/src/MapMarkerNativeComponent.ts +51 -0
- package/src/MapOverlay.tsx +178 -0
- package/src/MapPolygon.tsx +188 -0
- package/src/MapPolygon.types.ts +25 -0
- package/src/MapPolyline.tsx +215 -0
- package/src/MapUrlTile.tsx +169 -0
- package/src/MapView.tsx +1230 -0
- package/src/MapView.types.ts +212 -0
- package/src/MapView.web.ts +2 -0
- package/src/MapViewNativeComponent.ts +86 -0
- package/src/MapWMSTile.tsx +148 -0
- package/src/ProviderConstants.ts +2 -0
- package/src/createFabricMap.tsx +253 -0
- package/src/decorateMapComponent.ts +227 -0
- package/src/fixImageProp.ts +17 -0
- package/src/index.ts +52 -0
- package/src/sharedTypes.ts +101 -0
- package/{specs → src/specs}/NativeComponentCircle.ts +3 -4
- package/{specs → src/specs}/NativeComponentGoogleMapView.ts +15 -9
- package/{specs → src/specs}/NativeComponentMapView.ts +61 -32
- package/{specs → src/specs}/NativeComponentOverlay.ts +11 -2
- package/{specs → src/specs}/NativeComponentPolyline.ts +1 -1
- package/src/specs/NativeComponentUrlTile.ts +128 -0
- package/src/specs/NativeComponentWMSTile.ts +107 -0
- package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -533
- package/lib/AnimatedRegion.d.ts +0 -19
- package/lib/AnimatedRegion.js +0 -134
- package/lib/Geojson.d.ts +0 -204
- package/lib/Geojson.js +0 -166
- package/lib/MapCallout.d.ts +0 -40
- package/lib/MapCallout.js +0 -51
- package/lib/MapCalloutSubview.d.ts +0 -34
- package/lib/MapCalloutSubview.js +0 -48
- package/lib/MapCircle.d.ts +0 -117
- package/lib/MapCircle.js +0 -53
- package/lib/MapHeatmap.d.ts +0 -78
- package/lib/MapHeatmap.js +0 -59
- package/lib/MapLocalTile.d.ts +0 -35
- package/lib/MapLocalTile.js +0 -44
- package/lib/MapMarker.d.ts +0 -322
- package/lib/MapMarker.js +0 -158
- package/lib/MapMarkerNativeComponent.d.ts +0 -15
- package/lib/MapMarkerNativeComponent.js +0 -15
- package/lib/MapOverlay.d.ts +0 -88
- package/lib/MapOverlay.js +0 -65
- package/lib/MapPolygon.d.ts +0 -140
- package/lib/MapPolygon.js +0 -53
- package/lib/MapPolygon.types.d.ts +0 -18
- package/lib/MapPolygon.types.js +0 -2
- package/lib/MapPolyline.d.ts +0 -156
- package/lib/MapPolyline.js +0 -53
- package/lib/MapUrlTile.d.ts +0 -134
- package/lib/MapUrlTile.js +0 -44
- package/lib/MapView.d.ts +0 -703
- package/lib/MapView.js +0 -427
- package/lib/MapView.types.d.ts +0 -161
- package/lib/MapView.types.js +0 -2
- package/lib/MapView.web.d.ts +0 -1
- package/lib/MapView.web.js +0 -9
- package/lib/MapViewNativeComponent.d.ts +0 -18
- package/lib/MapViewNativeComponent.js +0 -19
- package/lib/MapWMSTile.d.ts +0 -116
- package/lib/MapWMSTile.js +0 -44
- package/lib/ProviderConstants.d.ts +0 -2
- package/lib/ProviderConstants.js +0 -5
- package/lib/createFabricMap.d.ts +0 -24
- package/lib/createFabricMap.js +0 -188
- package/lib/decorateMapComponent.d.ts +0 -36
- package/lib/decorateMapComponent.js +0 -120
- package/lib/fixImageProp.d.ts +0 -4
- package/lib/fixImageProp.js +0 -16
- package/lib/index.d.ts +0 -38
- package/lib/index.js +0 -81
- package/lib/sharedTypes.d.ts +0 -81
- package/lib/sharedTypes.js +0 -2
- package/lib/sharedTypesInternal.js +0 -2
- package/lib/specs/NativeAirMapsModule.d.ts +0 -31
- package/lib/specs/NativeAirMapsModule.js +0 -4
- package/lib/specs/NativeComponentCallout.d.ts +0 -46
- package/lib/specs/NativeComponentCallout.js +0 -9
- package/lib/specs/NativeComponentCircle.d.ts +0 -74
- package/lib/specs/NativeComponentCircle.js +0 -7
- package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -713
- package/lib/specs/NativeComponentGoogleMapView.js +0 -22
- package/lib/specs/NativeComponentGooglePolygon.d.ts +0 -75
- package/lib/specs/NativeComponentGooglePolygon.js +0 -7
- package/lib/specs/NativeComponentMapView.d.ts +0 -847
- package/lib/specs/NativeComponentMapView.js +0 -20
- package/lib/specs/NativeComponentMarker.d.ts +0 -258
- package/lib/specs/NativeComponentMarker.js +0 -19
- package/lib/specs/NativeComponentOverlay.d.ts +0 -67
- package/lib/specs/NativeComponentOverlay.js +0 -7
- package/lib/specs/NativeComponentPolyline.d.ts +0 -101
- package/lib/specs/NativeComponentPolyline.js +0 -7
- /package/ios/AirMaps/{UIView +AirMap.m → UIView+AirMap.m} +0 -0
- /package/ios/{AirMaps → generated}/RNMapsHostVewDelegate.h +0 -0
- /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
- /package/{specs → src/specs}/NativeAirMapsModule.ts +0 -0
- /package/{specs → src/specs}/NativeComponentCallout.ts +0 -0
- /package/{specs → src/specs}/NativeComponentGooglePolygon.ts +0 -0
- /package/{specs → src/specs}/NativeComponentMarker.ts +0 -0
|
@@ -0,0 +1,543 @@
|
|
|
1
|
+
//
|
|
2
|
+
// AIRGoogleMapManager.m
|
|
3
|
+
// AirMaps
|
|
4
|
+
//
|
|
5
|
+
// Created by Gil Birman on 9/1/16.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
#ifdef HAVE_GOOGLE_MAPS
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
#import "AIRGoogleMapManager.h"
|
|
12
|
+
#import <React/RCTViewManager.h>
|
|
13
|
+
#import <React/RCTBridge.h>
|
|
14
|
+
#import <React/RCTUIManager.h>
|
|
15
|
+
#import <React/RCTConvert+CoreLocation.h>
|
|
16
|
+
#import <React/RCTEventDispatcher.h>
|
|
17
|
+
#import <React/RCTViewManager.h>
|
|
18
|
+
#import <React/RCTConvert.h>
|
|
19
|
+
#import <React/UIView+React.h>
|
|
20
|
+
#import "RCTConvert+GMSMapViewType.h"
|
|
21
|
+
#import "AIRGoogleMap.h"
|
|
22
|
+
#import "AIRGoogleMapMarker.h"
|
|
23
|
+
#import "AIRGoogleMapCoordinate.h"
|
|
24
|
+
#import "RCTConvert+GMSMapViewType.h"
|
|
25
|
+
#import <MapKit/MapKit.h>
|
|
26
|
+
#import <QuartzCore/QuartzCore.h>
|
|
27
|
+
|
|
28
|
+
#if __has_include(<ReactNativeMapsGenerated/RNMapsAirModuleDelegate.h>)
|
|
29
|
+
#import <ReactNativeMapsGenerated/RNMapsAirModuleDelegate.h>
|
|
30
|
+
#else
|
|
31
|
+
#import <react-native-maps-generated/RNMapsAirModuleDelegate.h>
|
|
32
|
+
#endif
|
|
33
|
+
|
|
34
|
+
static NSString *const RCTMapViewKey = @"MapView";
|
|
35
|
+
|
|
36
|
+
|
|
37
|
+
@interface AIRGoogleMapManager() <GMSMapViewDelegate>
|
|
38
|
+
{
|
|
39
|
+
BOOL didCallOnMapReady;
|
|
40
|
+
}
|
|
41
|
+
@end
|
|
42
|
+
|
|
43
|
+
@implementation AIRGoogleMapManager
|
|
44
|
+
|
|
45
|
+
RCT_EXPORT_MODULE()
|
|
46
|
+
|
|
47
|
+
- (UIView *)view
|
|
48
|
+
{
|
|
49
|
+
|
|
50
|
+
if (self.initialProps){
|
|
51
|
+
if (self.initialProps[@"googleMapId"]){
|
|
52
|
+
_googleMapId = self.initialProps[@"googleMapId"];
|
|
53
|
+
}
|
|
54
|
+
if (self.initialProps[@"zoomTapEnabled"]){
|
|
55
|
+
_zoomTapEnabled = self.initialProps[@"zoomTapEnabled"];
|
|
56
|
+
}
|
|
57
|
+
if (self.initialProps[@"loadingBackgroundColor"]){
|
|
58
|
+
_backgroundColor = [RCTConvert UIColor:self.initialProps[@"loadingBackgroundColor"]];
|
|
59
|
+
}
|
|
60
|
+
if (self.initialProps[@"initialCamera"]){
|
|
61
|
+
_camera = [RCTConvert GMSCameraPositionWithDefaults:self.initialProps[@"initialCamera"] existingCamera:nil];
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
AIRGoogleMap *map = [[AIRGoogleMap alloc] initWithMapId:self.googleMapId initialCamera:self.camera backgroundColor:self.backgroundColor andZoomTapEnabled:self.zoomTapEnabled];
|
|
65
|
+
map.bridge = self.bridge;
|
|
66
|
+
map.delegate = self;
|
|
67
|
+
map.isAccessibilityElement = NO;
|
|
68
|
+
map.accessibilityElementsHidden = NO;
|
|
69
|
+
map.settings.consumesGesturesInView = NO;
|
|
70
|
+
if (self.customMapStyle != nil){
|
|
71
|
+
map.customMapStyleString = self.customMapStyle;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
UIPanGestureRecognizer *drag = [[UIPanGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDrag:)];
|
|
75
|
+
[drag setMinimumNumberOfTouches:1];
|
|
76
|
+
[drag setMaximumNumberOfTouches:1];
|
|
77
|
+
[map addGestureRecognizer:drag];
|
|
78
|
+
|
|
79
|
+
UIPinchGestureRecognizer *pinch = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handleMapDrag:)];
|
|
80
|
+
[map addGestureRecognizer:pinch];
|
|
81
|
+
|
|
82
|
+
return map;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
RCT_EXPORT_VIEW_PROPERTY(isAccessibilityElement, BOOL)
|
|
86
|
+
RCT_REMAP_VIEW_PROPERTY(testID, accessibilityIdentifier, NSString)
|
|
87
|
+
RCT_EXPORT_VIEW_PROPERTY(googleMapId, NSString)
|
|
88
|
+
RCT_EXPORT_VIEW_PROPERTY(initialCamera, GMSCameraPosition)
|
|
89
|
+
RCT_REMAP_VIEW_PROPERTY(camera, cameraProp, GMSCameraPosition)
|
|
90
|
+
RCT_EXPORT_VIEW_PROPERTY(initialRegion, MKCoordinateRegion)
|
|
91
|
+
RCT_EXPORT_VIEW_PROPERTY(region, MKCoordinateRegion)
|
|
92
|
+
RCT_EXPORT_VIEW_PROPERTY(showsBuildings, BOOL)
|
|
93
|
+
RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
|
|
94
|
+
//RCT_EXPORT_VIEW_PROPERTY(showsScale, BOOL) // Not supported by GoogleMaps
|
|
95
|
+
RCT_EXPORT_VIEW_PROPERTY(showsTraffic, BOOL)
|
|
96
|
+
RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
|
|
97
|
+
RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
|
|
98
|
+
RCT_EXPORT_VIEW_PROPERTY(scrollEnabled, BOOL)
|
|
99
|
+
RCT_EXPORT_VIEW_PROPERTY(scrollDuringRotateOrZoomEnabled, BOOL)
|
|
100
|
+
RCT_EXPORT_VIEW_PROPERTY(pitchEnabled, BOOL)
|
|
101
|
+
RCT_EXPORT_VIEW_PROPERTY(zoomTapEnabled, BOOL)
|
|
102
|
+
RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
|
|
103
|
+
RCT_EXPORT_VIEW_PROPERTY(showsMyLocationButton, BOOL)
|
|
104
|
+
RCT_EXPORT_VIEW_PROPERTY(showsIndoors, BOOL)
|
|
105
|
+
RCT_EXPORT_VIEW_PROPERTY(showsIndoorLevelPicker, BOOL)
|
|
106
|
+
RCT_EXPORT_VIEW_PROPERTY(customMapStyleString, NSString)
|
|
107
|
+
RCT_EXPORT_VIEW_PROPERTY(mapPadding, UIEdgeInsets)
|
|
108
|
+
RCT_REMAP_VIEW_PROPERTY(paddingAdjustmentBehavior, paddingAdjustmentBehaviorString, NSString)
|
|
109
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapReady, RCTDirectEventBlock)
|
|
110
|
+
RCT_EXPORT_VIEW_PROPERTY(onMapLoaded, RCTDirectEventBlock)
|
|
111
|
+
RCT_EXPORT_VIEW_PROPERTY(onKmlReady, RCTDirectEventBlock)
|
|
112
|
+
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
|
|
113
|
+
RCT_EXPORT_VIEW_PROPERTY(onLongPress, RCTBubblingEventBlock)
|
|
114
|
+
RCT_EXPORT_VIEW_PROPERTY(onPanDrag, RCTDirectEventBlock)
|
|
115
|
+
RCT_EXPORT_VIEW_PROPERTY(onUserLocationChange, RCTDirectEventBlock)
|
|
116
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerPress, RCTDirectEventBlock)
|
|
117
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerSelect, RCTDirectEventBlock)
|
|
118
|
+
RCT_EXPORT_VIEW_PROPERTY(onMarkerDeselect, RCTDirectEventBlock)
|
|
119
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeStart, RCTDirectEventBlock)
|
|
120
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChange, RCTDirectEventBlock)
|
|
121
|
+
RCT_EXPORT_VIEW_PROPERTY(onRegionChangeComplete, RCTDirectEventBlock)
|
|
122
|
+
RCT_EXPORT_VIEW_PROPERTY(onPoiClick, RCTDirectEventBlock)
|
|
123
|
+
RCT_EXPORT_VIEW_PROPERTY(onIndoorLevelActivated, RCTDirectEventBlock)
|
|
124
|
+
RCT_EXPORT_VIEW_PROPERTY(onIndoorBuildingFocused, RCTDirectEventBlock)
|
|
125
|
+
RCT_EXPORT_VIEW_PROPERTY(mapType, GMSMapViewType)
|
|
126
|
+
RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, CGFloat)
|
|
127
|
+
RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, CGFloat)
|
|
128
|
+
RCT_EXPORT_VIEW_PROPERTY(kmlSrc, NSString)
|
|
129
|
+
RCT_EXPORT_VIEW_PROPERTY(loadingBackgroundColor, UIColor)
|
|
130
|
+
|
|
131
|
+
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
132
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
133
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
134
|
+
{
|
|
135
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
136
|
+
id view = viewRegistry[reactTag];
|
|
137
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
138
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view], NULL);
|
|
139
|
+
} else {
|
|
140
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
141
|
+
resolve(@{
|
|
142
|
+
@"center": @{
|
|
143
|
+
@"latitude": @(mapView.camera.target.latitude),
|
|
144
|
+
@"longitude": @(mapView.camera.target.longitude),
|
|
145
|
+
},
|
|
146
|
+
@"pitch": @(mapView.camera.viewingAngle),
|
|
147
|
+
@"heading": @(mapView.camera.bearing),
|
|
148
|
+
@"zoom": @(mapView.camera.zoom),
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
}];
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
RCT_EXPORT_METHOD(setCamera:(nonnull NSNumber *)reactTag
|
|
155
|
+
camera:(id)json)
|
|
156
|
+
{
|
|
157
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
158
|
+
id view = viewRegistry[reactTag];
|
|
159
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
160
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
161
|
+
} else {
|
|
162
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
163
|
+
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView cameraProp]];
|
|
164
|
+
[mapView setCameraProp:camera];
|
|
165
|
+
}
|
|
166
|
+
}];
|
|
167
|
+
}
|
|
168
|
+
|
|
169
|
+
|
|
170
|
+
RCT_EXPORT_METHOD(animateCamera:(nonnull NSNumber *)reactTag
|
|
171
|
+
withCamera:(id)json
|
|
172
|
+
withDuration:(CGFloat)duration)
|
|
173
|
+
{
|
|
174
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
175
|
+
id view = viewRegistry[reactTag];
|
|
176
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
177
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
178
|
+
} else {
|
|
179
|
+
[CATransaction begin];
|
|
180
|
+
[CATransaction setAnimationDuration:duration/1000];
|
|
181
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
182
|
+
GMSCameraPosition *camera = [RCTConvert GMSCameraPositionWithDefaults:json existingCamera:[mapView cameraProp]];
|
|
183
|
+
[mapView animateToCameraPosition:camera];
|
|
184
|
+
[CATransaction commit];
|
|
185
|
+
}
|
|
186
|
+
}];
|
|
187
|
+
}
|
|
188
|
+
|
|
189
|
+
RCT_EXPORT_METHOD(animateToRegion:(nonnull NSNumber *)reactTag
|
|
190
|
+
withRegion:(MKCoordinateRegion)region
|
|
191
|
+
withDuration:(CGFloat)duration)
|
|
192
|
+
{
|
|
193
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
194
|
+
id view = viewRegistry[reactTag];
|
|
195
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
196
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
197
|
+
} else {
|
|
198
|
+
// Core Animation must be used to control the animation's duration
|
|
199
|
+
// See http://stackoverflow.com/a/15663039/171744
|
|
200
|
+
[CATransaction begin];
|
|
201
|
+
[CATransaction setAnimationDuration:duration/1000];
|
|
202
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
203
|
+
GMSCameraPosition *camera = [AIRGoogleMap makeGMSCameraPositionFromMap:mapView andMKCoordinateRegion:region];
|
|
204
|
+
[mapView animateToCameraPosition:camera];
|
|
205
|
+
[CATransaction commit];
|
|
206
|
+
}
|
|
207
|
+
}];
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
RCT_EXPORT_METHOD(fitToElements:(nonnull NSNumber *)reactTag
|
|
211
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
212
|
+
animated:(BOOL)animated)
|
|
213
|
+
{
|
|
214
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
215
|
+
id view = viewRegistry[reactTag];
|
|
216
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
217
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
218
|
+
} else {
|
|
219
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
220
|
+
[mapView fitToElementsWithEdgePadding:edgePadding animated:animated];
|
|
221
|
+
}
|
|
222
|
+
}];
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
RCT_EXPORT_METHOD(fitToSuppliedMarkers:(nonnull NSNumber *)reactTag
|
|
226
|
+
markers:(nonnull NSArray *)markers
|
|
227
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
228
|
+
animated:(BOOL)animated)
|
|
229
|
+
{
|
|
230
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
231
|
+
id view = viewRegistry[reactTag];
|
|
232
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
233
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
234
|
+
} else {
|
|
235
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
236
|
+
[mapView fitToSuppliedMarkers:markers withEdgePadding:edgePadding animated:animated];
|
|
237
|
+
}
|
|
238
|
+
}];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
RCT_EXPORT_METHOD(fitToCoordinates:(nonnull NSNumber *)reactTag
|
|
242
|
+
coordinates:(nonnull NSArray<AIRGoogleMapCoordinate *> *)coordinates
|
|
243
|
+
edgePadding:(nonnull NSDictionary *)edgePadding
|
|
244
|
+
animated:(BOOL)animated)
|
|
245
|
+
{
|
|
246
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
247
|
+
id view = viewRegistry[reactTag];
|
|
248
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
249
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
250
|
+
} else {
|
|
251
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
252
|
+
[mapView fitToCoordinates:coordinates withEdgePadding:edgePadding animated:animated];
|
|
253
|
+
}
|
|
254
|
+
}];
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)reactTag
|
|
258
|
+
withWidth:(nonnull NSNumber *)width
|
|
259
|
+
withHeight:(nonnull NSNumber *)height
|
|
260
|
+
withRegion:(MKCoordinateRegion)region
|
|
261
|
+
format:(nonnull NSString *)format
|
|
262
|
+
quality:(nonnull NSNumber *)quality
|
|
263
|
+
result:(nonnull NSString *)result
|
|
264
|
+
withCallback:(RCTPromiseResolveBlock)callback)
|
|
265
|
+
{
|
|
266
|
+
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
|
267
|
+
NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format];
|
|
268
|
+
NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent: pathComponent];
|
|
269
|
+
|
|
270
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
271
|
+
id view = viewRegistry[reactTag];
|
|
272
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
273
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
274
|
+
} else {
|
|
275
|
+
NSMutableDictionary* config = [NSMutableDictionary new];
|
|
276
|
+
|
|
277
|
+
[view takeSnapshotWithConfig:config success:callback error:^(NSString *code, NSString *message, NSError *error) {
|
|
278
|
+
callback(@[error]);
|
|
279
|
+
}];
|
|
280
|
+
|
|
281
|
+
[config setObject:width forKey:@"width"];
|
|
282
|
+
[config setObject:height forKey:@"height"];
|
|
283
|
+
[config setObject:format forKey:@"format"];
|
|
284
|
+
[config setObject:quality forKey:@"quality"];
|
|
285
|
+
[config setObject:result forKey:@"result"];
|
|
286
|
+
[config setObject:filePath forKey:@"filePath"];
|
|
287
|
+
|
|
288
|
+
// TODO: currently we are ignoring width, height, region
|
|
289
|
+
|
|
290
|
+
AIRGoogleMap* mapView = (AIRGoogleMap *) view;
|
|
291
|
+
|
|
292
|
+
|
|
293
|
+
UIGraphicsBeginImageContextWithOptions(mapView.frame.size, YES, 0.0f);
|
|
294
|
+
[mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
|
|
295
|
+
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
296
|
+
|
|
297
|
+
NSData *data;
|
|
298
|
+
if ([format isEqualToString:@"png"]) {
|
|
299
|
+
data = UIImagePNGRepresentation(image);
|
|
300
|
+
|
|
301
|
+
}
|
|
302
|
+
else if([format isEqualToString:@"jpg"]) {
|
|
303
|
+
data = UIImageJPEGRepresentation(image, quality.floatValue);
|
|
304
|
+
}
|
|
305
|
+
|
|
306
|
+
if ([result isEqualToString:@"file"]) {
|
|
307
|
+
[data writeToFile:filePath atomically:YES];
|
|
308
|
+
callback(@[[NSNull null], filePath]);
|
|
309
|
+
}
|
|
310
|
+
else if ([result isEqualToString:@"base64"]) {
|
|
311
|
+
callback(@[[NSNull null], [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn]]);
|
|
312
|
+
}
|
|
313
|
+
}
|
|
314
|
+
UIGraphicsEndImageContext();
|
|
315
|
+
}];
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
319
|
+
coordinate:(NSDictionary *)coordinate
|
|
320
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
321
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
322
|
+
{
|
|
323
|
+
CLLocationCoordinate2D coord =
|
|
324
|
+
CLLocationCoordinate2DMake(
|
|
325
|
+
[coordinate[@"latitude"] doubleValue],
|
|
326
|
+
[coordinate[@"longitude"] doubleValue]
|
|
327
|
+
);
|
|
328
|
+
|
|
329
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
330
|
+
id view = viewRegistry[reactTag];
|
|
331
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
332
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
333
|
+
} else {
|
|
334
|
+
id<RNMapsAirModuleDelegate> mapView = (id<RNMapsAirModuleDelegate>) view;
|
|
335
|
+
resolve([mapView getPointForCoordinates:coord]);
|
|
336
|
+
}
|
|
337
|
+
}];
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
341
|
+
point:(NSDictionary *)point
|
|
342
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
343
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
344
|
+
{
|
|
345
|
+
CGPoint pt = CGPointMake(
|
|
346
|
+
[point[@"x"] doubleValue],
|
|
347
|
+
[point[@"y"] doubleValue]
|
|
348
|
+
);
|
|
349
|
+
|
|
350
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
351
|
+
id view = viewRegistry[reactTag];
|
|
352
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
353
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
354
|
+
} else {
|
|
355
|
+
id<RNMapsAirModuleDelegate> mapView = (id<RNMapsAirModuleDelegate>) view;
|
|
356
|
+
resolve([view getCoordinatesForPoint:pt]);
|
|
357
|
+
}
|
|
358
|
+
}];
|
|
359
|
+
}
|
|
360
|
+
|
|
361
|
+
RCT_EXPORT_METHOD(getMarkersFrames:(nonnull NSNumber *)reactTag
|
|
362
|
+
onlyVisible:(BOOL)onlyVisible
|
|
363
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
364
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
365
|
+
{
|
|
366
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
367
|
+
id view = viewRegistry[reactTag];
|
|
368
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
369
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
370
|
+
} else {
|
|
371
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
372
|
+
resolve([mapView getMarkersFramesWithOnlyVisible:onlyVisible]);
|
|
373
|
+
}
|
|
374
|
+
}];
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)reactTag
|
|
378
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
379
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
380
|
+
{
|
|
381
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
382
|
+
id view = viewRegistry[reactTag];
|
|
383
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
384
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
385
|
+
} else {
|
|
386
|
+
resolve([view getMapBoundaries]);
|
|
387
|
+
}
|
|
388
|
+
}];
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
RCT_EXPORT_METHOD(setMapBoundaries:(nonnull NSNumber *)reactTag
|
|
392
|
+
northEast:(CLLocationCoordinate2D)northEast
|
|
393
|
+
southWest:(CLLocationCoordinate2D)southWest)
|
|
394
|
+
{
|
|
395
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
396
|
+
id view = viewRegistry[reactTag];
|
|
397
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
398
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
399
|
+
} else {
|
|
400
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
401
|
+
|
|
402
|
+
GMSCoordinateBounds *bounds = [[GMSCoordinateBounds alloc] initWithCoordinate:northEast coordinate:southWest];
|
|
403
|
+
|
|
404
|
+
mapView.cameraTargetBounds = bounds;
|
|
405
|
+
}
|
|
406
|
+
}];
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
RCT_EXPORT_METHOD(setIndoorActiveLevelIndex:(nonnull NSNumber *)reactTag
|
|
410
|
+
levelIndex:(NSInteger) levelIndex)
|
|
411
|
+
{
|
|
412
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
413
|
+
id view = viewRegistry[reactTag];
|
|
414
|
+
if (![view isKindOfClass:[AIRGoogleMap class]]) {
|
|
415
|
+
RCTLogError(@"Invalid view returned from registry, expecting AIRGoogleMap, got: %@", view);
|
|
416
|
+
} else {
|
|
417
|
+
AIRGoogleMap *mapView = (AIRGoogleMap *)view;
|
|
418
|
+
if (!mapView.indoorDisplay) {
|
|
419
|
+
return;
|
|
420
|
+
}
|
|
421
|
+
if ( levelIndex < [mapView.indoorDisplay.activeBuilding.levels count]) {
|
|
422
|
+
mapView.indoorDisplay.activeLevel = mapView.indoorDisplay.activeBuilding.levels[levelIndex];
|
|
423
|
+
}
|
|
424
|
+
}
|
|
425
|
+
}];
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
+ (BOOL)requiresMainQueueSetup {
|
|
429
|
+
return YES;
|
|
430
|
+
}
|
|
431
|
+
|
|
432
|
+
- (NSDictionary *)constantsToExport {
|
|
433
|
+
return @{ @"legalNotice": [GMSServices openSourceLicenseInfo] };
|
|
434
|
+
}
|
|
435
|
+
|
|
436
|
+
- (void)mapView:(GMSMapView *)mapView willMove:(BOOL)gesture {
|
|
437
|
+
self.isGesture = gesture;
|
|
438
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
439
|
+
[googleMapView willMove:gesture];
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
- (void)mapViewDidStartTileRendering:(GMSMapView *)mapView {
|
|
443
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
444
|
+
[googleMapView didPrepareMap];
|
|
445
|
+
}
|
|
446
|
+
|
|
447
|
+
- (void)mapViewDidFinishTileRendering:(GMSMapView *)mapView {
|
|
448
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
449
|
+
[googleMapView mapViewDidFinishTileRendering];
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
- (BOOL)mapView:(GMSMapView *)mapView didTapMarker:(GMSMarker *)marker {
|
|
453
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
454
|
+
return [googleMapView didTapMarker:marker];
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
- (void)mapView:(GMSMapView *)mapView didTapOverlay:(GMSPolygon *)polygon {
|
|
458
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
459
|
+
[googleMapView didTapPolygon:polygon];
|
|
460
|
+
}
|
|
461
|
+
|
|
462
|
+
- (void)mapView:(GMSMapView *)mapView didTapAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
463
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
464
|
+
[googleMapView didTapAtCoordinate:coordinate];
|
|
465
|
+
}
|
|
466
|
+
|
|
467
|
+
- (void)mapView:(GMSMapView *)mapView didLongPressAtCoordinate:(CLLocationCoordinate2D)coordinate {
|
|
468
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
469
|
+
[googleMapView didLongPressAtCoordinate:coordinate];
|
|
470
|
+
}
|
|
471
|
+
|
|
472
|
+
- (void)mapView:(GMSMapView *)mapView didChangeCameraPosition:(GMSCameraPosition *)position {
|
|
473
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
474
|
+
[googleMapView didChangeCameraPosition:position isGesture:self.isGesture];
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
- (void)mapView:(GMSMapView *)mapView idleAtCameraPosition:(GMSCameraPosition *)position {
|
|
478
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
479
|
+
[googleMapView idleAtCameraPosition:position isGesture:self.isGesture];
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
- (UIView *)mapView:(GMSMapView *)mapView markerInfoWindow:(GMSMarker *)marker {
|
|
483
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
484
|
+
return [aMarker.fakeMarker markerInfoWindow];}
|
|
485
|
+
|
|
486
|
+
- (UIView *)mapView:(GMSMapView *)mapView markerInfoContents:(GMSMarker *)marker {
|
|
487
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
488
|
+
return [aMarker.fakeMarker markerInfoContents];
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
- (void)mapView:(GMSMapView *)mapView didTapInfoWindowOfMarker:(GMSMarker *)marker {
|
|
492
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
493
|
+
[aMarker.fakeMarker didTapInfoWindowOfMarker:aMarker];
|
|
494
|
+
}
|
|
495
|
+
|
|
496
|
+
- (void)mapView:(GMSMapView *)mapView didBeginDraggingMarker:(GMSMarker *)marker {
|
|
497
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
498
|
+
[aMarker.fakeMarker didBeginDraggingMarker:aMarker];
|
|
499
|
+
}
|
|
500
|
+
|
|
501
|
+
- (void)mapView:(GMSMapView *)mapView didEndDraggingMarker:(GMSMarker *)marker {
|
|
502
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
503
|
+
[aMarker.fakeMarker didEndDraggingMarker:aMarker];
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
- (void)mapView:(GMSMapView *)mapView didDragMarker:(GMSMarker *)marker {
|
|
507
|
+
AIRGMSMarker *aMarker = (AIRGMSMarker *)marker;
|
|
508
|
+
[aMarker.fakeMarker didDragMarker:aMarker];
|
|
509
|
+
}
|
|
510
|
+
|
|
511
|
+
- (void)mapView:(GMSMapView *)mapView
|
|
512
|
+
didTapPOIWithPlaceID:(NSString *)placeID
|
|
513
|
+
name:(NSString *)name
|
|
514
|
+
location:(CLLocationCoordinate2D)location {
|
|
515
|
+
AIRGoogleMap *googleMapView = (AIRGoogleMap *)mapView;
|
|
516
|
+
[googleMapView didTapPOIWithPlaceID:placeID name:name location:location];
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
#pragma mark Gesture Recognizer Handlers
|
|
520
|
+
|
|
521
|
+
- (void)handleMapDrag:(UIPanGestureRecognizer*)recognizer {
|
|
522
|
+
AIRGoogleMap *map = (AIRGoogleMap *)recognizer.view;
|
|
523
|
+
if (!map.onPanDrag) return;
|
|
524
|
+
|
|
525
|
+
CGPoint touchPoint = [recognizer locationInView:map];
|
|
526
|
+
CLLocationCoordinate2D coord = [map.projection coordinateForPoint:touchPoint];
|
|
527
|
+
map.onPanDrag(@{
|
|
528
|
+
@"coordinate": @{
|
|
529
|
+
@"latitude": @(coord.latitude),
|
|
530
|
+
@"longitude": @(coord.longitude),
|
|
531
|
+
},
|
|
532
|
+
@"position": @{
|
|
533
|
+
@"x": @(touchPoint.x),
|
|
534
|
+
@"y": @(touchPoint.y),
|
|
535
|
+
},
|
|
536
|
+
@"numberOfTouches": @(recognizer.numberOfTouches),
|
|
537
|
+
});
|
|
538
|
+
|
|
539
|
+
}
|
|
540
|
+
|
|
541
|
+
@end
|
|
542
|
+
|
|
543
|
+
#endif
|
|
@@ -29,8 +29,8 @@ CGRect unionRect(CGRect a, CGRect b) {
|
|
|
29
29
|
@implementation AIRGoogleMapMarker {
|
|
30
30
|
RCTImageLoaderCancellationBlock _reloadImageCancellationBlock;
|
|
31
31
|
RCTBubblingEventBlock _onPress;
|
|
32
|
-
|
|
33
|
-
|
|
32
|
+
RCTDirectEventBlock _onSelect;
|
|
33
|
+
RCTDirectEventBlock _onDeselect;
|
|
34
34
|
__weak UIImageView *_iconImageView;
|
|
35
35
|
UIView *_iconView;
|
|
36
36
|
UIColor *_pinColor;
|
|
@@ -376,7 +376,7 @@ CGRect unionRect(CGRect a, CGRect b) {
|
|
|
376
376
|
// TODO(lmr): do something with the error?
|
|
377
377
|
NSLog(@"%@", error);
|
|
378
378
|
}
|
|
379
|
-
|
|
379
|
+
|
|
380
380
|
dispatch_async(dispatch_get_main_queue(), ^{
|
|
381
381
|
__strong AIRGoogleMapMarker* strongSelf = weakSelf;
|
|
382
382
|
|
|
@@ -86,7 +86,7 @@ RCT_EXPORT_METHOD(redrawCallout:(nonnull NSNumber *)reactTag)
|
|
|
86
86
|
RCTLogError(@"Invalid view returned from registry, expecting AIRMap, got: %@", view);
|
|
87
87
|
} else {
|
|
88
88
|
AIRGoogleMapMarker* marker = (AIRGoogleMapMarker *) view;
|
|
89
|
-
|
|
89
|
+
|
|
90
90
|
[NSTimer scheduledTimerWithTimeInterval:0.0
|
|
91
91
|
target:[NSBlockOperation blockOperationWithBlock:^{
|
|
92
92
|
[marker hideCalloutView];
|
|
@@ -28,11 +28,11 @@
|
|
|
28
28
|
NSInteger *maximumZ = self.maximumZ;
|
|
29
29
|
NSInteger *minimumZ = self.minimumZ;
|
|
30
30
|
GMSTileURLConstructor urls = ^NSURL* _Nullable (NSUInteger x, NSUInteger y, NSUInteger zoom) {
|
|
31
|
-
|
|
31
|
+
|
|
32
32
|
if (self.flipY == YES) {
|
|
33
33
|
y = (1 << zoom) - y - 1;
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
|
|
36
36
|
NSString *url = urlTemplate;
|
|
37
37
|
url = [url stringByReplacingOccurrencesOfString:@"{x}" withString:[NSString stringWithFormat: @"%ld", (long)x]];
|
|
38
38
|
url = [url stringByReplacingOccurrencesOfString:@"{y}" withString:[NSString stringWithFormat: @"%ld", (long)y]];
|
|
@@ -10,8 +10,11 @@
|
|
|
10
10
|
|
|
11
11
|
#import <React/RCTViewComponentView.h>
|
|
12
12
|
#import <UIKit/UIKit.h>
|
|
13
|
-
#
|
|
14
|
-
|
|
13
|
+
#if __has_include(<ReactNativeMapsGenerated/RNMapsAirModuleDelegate.h>)
|
|
14
|
+
#import <ReactNativeMapsGenerated/RNMapsHostVewDelegate.h>
|
|
15
|
+
#else
|
|
16
|
+
#import <react-native-maps-generated/RNMapsHostVewDelegate.h>
|
|
17
|
+
#endif
|
|
15
18
|
@class AIRGoogleMap;
|
|
16
19
|
|
|
17
20
|
NS_ASSUME_NONNULL_BEGIN
|