react-native-maps 2.0.0-beta.4 → 2.0.0-beta.6
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 +32 -5
- 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 +1 -1
- 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 +4 -4
- package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +1 -1
- package/android/src/main/java/com/rnmaps/maps/MapView.java +9 -9
- package/android/src/main/java/com/rnmaps/maps/{MapModule.java → MapViewModule.java} +18 -18
- 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/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} +77 -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/{AirGoogleMaps/AIRGoogleMapManager.m → GoogleMaps/RNMGoogleMapManager.m} +63 -229
- 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 +183 -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} +8 -8
- package/ios/{AirMaps/AIRMap.h → Maps/RNMMap.h} +8 -8
- package/ios/{AirMaps/AIRMap.m → Maps/RNMMap.m} +56 -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/{AirMaps/AIRMapManager.m → Maps/RNMMapManager.m} +168 -445
- 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 +297 -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 +4 -9
- package/lib/MapView.js +74 -90
- package/lib/MapView.types.d.ts +7 -1
- package/lib/MapWMSTile.js +2 -2
- package/lib/NativeGoogleMapViewModule.d.ts +20 -0
- package/lib/NativeGoogleMapViewModule.js +4 -0
- package/lib/NativeMapViewModule.d.ts +24 -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 +1 -1
- package/react-native-google-maps.podspec +1 -1
- package/react-native-maps.podspec +1 -1
- package/ios/AirGoogleMaps/AIRGoogleMapCalloutSubviewManager.m +0 -28
- package/ios/AirGoogleMaps/AIRGoogleMapHeatmapManager.h +0 -11
- package/ios/AirMaps/AIRMapCalloutSubviewManager.h +0 -14
- package/ios/AirMaps/AIRMapCalloutSubviewManager.m +0 -24
- 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/{AirGoogleMaps → GoogleMaps}/RCTConvert+GMSMapViewType.m +0 -0
- /package/ios/{AirMaps → Maps}/Callout/SMCalloutView.m +0 -0
package/ios/{AirGoogleMaps/AIRGoogleMapURLTileManager.m → GoogleMaps/RNMGoogleMapUrlTileManager.m}
RENAMED
|
@@ -1,24 +1,24 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
2
|
+
// RNMGoogleMapURLTileManager.m
|
|
3
3
|
// Created by Nick Italiano on 11/5/16.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
6
|
#ifdef HAVE_GOOGLE_MAPS
|
|
7
7
|
|
|
8
|
-
#import "
|
|
9
|
-
#import "
|
|
8
|
+
#import "RNMGoogleMapUrlTileManager.h"
|
|
9
|
+
#import "RNMGoogleMapUrlTile.h"
|
|
10
10
|
|
|
11
|
-
@interface
|
|
11
|
+
@interface RNMGoogleMapUrlTileManager()
|
|
12
12
|
|
|
13
13
|
@end
|
|
14
14
|
|
|
15
|
-
@implementation
|
|
15
|
+
@implementation RNMGoogleMapUrlTileManager
|
|
16
16
|
|
|
17
|
-
RCT_EXPORT_MODULE()
|
|
17
|
+
RCT_EXPORT_MODULE(RNMGoogleMapUrlTile)
|
|
18
18
|
|
|
19
19
|
- (UIView *)view
|
|
20
20
|
{
|
|
21
|
-
|
|
21
|
+
RNMGoogleMapUrlTile *tileLayer = [RNMGoogleMapUrlTile new];
|
|
22
22
|
return tileLayer;
|
|
23
23
|
}
|
|
24
24
|
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
#import "RNMGoogleMapViewModule.h"
|
|
2
|
+
#import "RNMGoogleMap.h"
|
|
3
|
+
#import <React/RCTUIManager.h>
|
|
4
|
+
#import <React/RCTUIManagerUtils.h>
|
|
5
|
+
|
|
6
|
+
@implementation RNMGoogleMapViewModule
|
|
7
|
+
|
|
8
|
+
@synthesize bridge = _bridge;
|
|
9
|
+
|
|
10
|
+
- (dispatch_queue_t)methodQueue
|
|
11
|
+
{
|
|
12
|
+
return RCTGetUIManagerQueue();
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
RCT_EXPORT_MODULE();
|
|
16
|
+
|
|
17
|
+
RCT_EXPORT_METHOD(getCamera:(nonnull NSNumber *)reactTag
|
|
18
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
19
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
20
|
+
{
|
|
21
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
22
|
+
id view = viewRegistry[reactTag];
|
|
23
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
24
|
+
reject(@"Invalid argument", [NSString stringWithFormat:@"Invalid view returned from registry, expecting RNMGoogleMap, got: %@", view], NULL);
|
|
25
|
+
} else {
|
|
26
|
+
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
27
|
+
resolve(@{
|
|
28
|
+
@"center": @{
|
|
29
|
+
@"latitude": @(mapView.camera.target.latitude),
|
|
30
|
+
@"longitude": @(mapView.camera.target.longitude),
|
|
31
|
+
},
|
|
32
|
+
@"pitch": @(mapView.camera.viewingAngle),
|
|
33
|
+
@"heading": @(mapView.camera.bearing),
|
|
34
|
+
@"zoom": @(mapView.camera.zoom),
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
}];
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
RCT_EXPORT_METHOD(takeSnapshot:(nonnull NSNumber *)reactTag
|
|
41
|
+
config:(NSDictionary *)config
|
|
42
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
43
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
44
|
+
{
|
|
45
|
+
NSString *format = config[@"format"];
|
|
46
|
+
NSNumber *quality = config[@"quality"];
|
|
47
|
+
NSString *result = config[@"result"];
|
|
48
|
+
NSTimeInterval timeStamp = [[NSDate date] timeIntervalSince1970];
|
|
49
|
+
NSString *pathComponent = [NSString stringWithFormat:@"Documents/snapshot-%.20lf.%@", timeStamp, format];
|
|
50
|
+
NSString *filePath = [NSHomeDirectory() stringByAppendingPathComponent: pathComponent];
|
|
51
|
+
|
|
52
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
53
|
+
id view = viewRegistry[reactTag];
|
|
54
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
55
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
56
|
+
} else {
|
|
57
|
+
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
58
|
+
|
|
59
|
+
// TODO: currently we are ignoring width, height, region
|
|
60
|
+
|
|
61
|
+
UIGraphicsBeginImageContextWithOptions(mapView.frame.size, YES, 0.0f);
|
|
62
|
+
[mapView.layer renderInContext:UIGraphicsGetCurrentContext()];
|
|
63
|
+
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
|
|
64
|
+
|
|
65
|
+
NSData *data;
|
|
66
|
+
if ([format isEqualToString:@"png"]) {
|
|
67
|
+
data = UIImagePNGRepresentation(image);
|
|
68
|
+
|
|
69
|
+
}
|
|
70
|
+
else if([format isEqualToString:@"jpg"]) {
|
|
71
|
+
data = UIImageJPEGRepresentation(image, quality.floatValue);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if ([result isEqualToString:@"file"]) {
|
|
75
|
+
[data writeToFile:filePath atomically:YES];
|
|
76
|
+
resolve(filePath);
|
|
77
|
+
}
|
|
78
|
+
else if ([result isEqualToString:@"base64"]) {
|
|
79
|
+
NSString *base64 = [data base64EncodedStringWithOptions:NSDataBase64EncodingEndLineWithCarriageReturn];
|
|
80
|
+
resolve(base64);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
UIGraphicsEndImageContext();
|
|
84
|
+
}];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
RCT_EXPORT_METHOD(pointForCoordinate:(nonnull NSNumber *)reactTag
|
|
88
|
+
coordinate:(NSDictionary *)coordinate
|
|
89
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
90
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
91
|
+
{
|
|
92
|
+
CLLocationCoordinate2D coord =
|
|
93
|
+
CLLocationCoordinate2DMake(
|
|
94
|
+
[coordinate[@"latitude"] doubleValue],
|
|
95
|
+
[coordinate[@"longitude"] doubleValue]
|
|
96
|
+
);
|
|
97
|
+
|
|
98
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
99
|
+
id view = viewRegistry[reactTag];
|
|
100
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
101
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
102
|
+
} else {
|
|
103
|
+
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
104
|
+
|
|
105
|
+
CGPoint touchPoint = [mapView.projection pointForCoordinate:coord];
|
|
106
|
+
|
|
107
|
+
resolve(@{
|
|
108
|
+
@"x": @(touchPoint.x),
|
|
109
|
+
@"y": @(touchPoint.y),
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
RCT_EXPORT_METHOD(coordinateForPoint:(nonnull NSNumber *)reactTag
|
|
116
|
+
point:(NSDictionary *)point
|
|
117
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
118
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
119
|
+
{
|
|
120
|
+
CGPoint pt = CGPointMake(
|
|
121
|
+
[point[@"x"] doubleValue],
|
|
122
|
+
[point[@"y"] doubleValue]
|
|
123
|
+
);
|
|
124
|
+
|
|
125
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
126
|
+
id view = viewRegistry[reactTag];
|
|
127
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
128
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
129
|
+
} else {
|
|
130
|
+
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
131
|
+
|
|
132
|
+
CLLocationCoordinate2D coordinate = [mapView.projection coordinateForPoint:pt];
|
|
133
|
+
|
|
134
|
+
resolve(@{
|
|
135
|
+
@"latitude": @(coordinate.latitude),
|
|
136
|
+
@"longitude": @(coordinate.longitude),
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
}];
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
RCT_EXPORT_METHOD(getMarkersFrames:(nonnull NSNumber *)reactTag
|
|
143
|
+
onlyVisible:(BOOL)onlyVisible
|
|
144
|
+
resolver: (RCTPromiseResolveBlock)resolve
|
|
145
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
146
|
+
{
|
|
147
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
148
|
+
id view = viewRegistry[reactTag];
|
|
149
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
150
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMMap, got: %@", view);
|
|
151
|
+
} else {
|
|
152
|
+
RNMGoogleMap *mapView = (RNMGoogleMap *)view;
|
|
153
|
+
resolve([mapView getMarkersFramesWithOnlyVisible:onlyVisible]);
|
|
154
|
+
}
|
|
155
|
+
}];
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
RCT_EXPORT_METHOD(getMapBoundaries:(nonnull NSNumber *)reactTag
|
|
159
|
+
resolver:(RCTPromiseResolveBlock)resolve
|
|
160
|
+
rejecter:(RCTPromiseRejectBlock)reject)
|
|
161
|
+
{
|
|
162
|
+
[self.bridge.uiManager addUIBlock:^(__unused RCTUIManager *uiManager, NSDictionary<NSNumber *, UIView *> *viewRegistry) {
|
|
163
|
+
id view = viewRegistry[reactTag];
|
|
164
|
+
if (![view isKindOfClass:[RNMGoogleMap class]]) {
|
|
165
|
+
RCTLogError(@"Invalid view returned from registry, expecting RNMGoogleMap, got: %@", view);
|
|
166
|
+
} else {
|
|
167
|
+
NSArray *boundingBox = [view getMapBoundaries];
|
|
168
|
+
|
|
169
|
+
resolve(@{
|
|
170
|
+
@"northEast" : @{
|
|
171
|
+
@"longitude" : boundingBox[0][0],
|
|
172
|
+
@"latitude" : boundingBox[0][1]
|
|
173
|
+
},
|
|
174
|
+
@"southWest" : @{
|
|
175
|
+
@"longitude" : boundingBox[1][0],
|
|
176
|
+
@"latitude" : boundingBox[1][1]
|
|
177
|
+
}
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
}];
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
@end
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMGoogleMapWMSTile.h
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
@property (nonatomic, assign) NSInteger minimumZ;
|
|
19
19
|
@end
|
|
20
20
|
|
|
21
|
-
@interface
|
|
21
|
+
@interface RNMGoogleMapWMSTile : UIView
|
|
22
22
|
@property (nonatomic, strong) WMSTileOverlay *tileLayer;
|
|
23
23
|
@property (nonatomic, assign) NSString *urlTemplate;
|
|
24
24
|
@property (nonatomic, assign) int zIndex;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMGoogleMapWMSTile.m
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -8,9 +8,9 @@
|
|
|
8
8
|
|
|
9
9
|
#ifdef HAVE_GOOGLE_MAPS
|
|
10
10
|
|
|
11
|
-
#import "
|
|
11
|
+
#import "RNMGoogleMapWMSTile.h"
|
|
12
12
|
|
|
13
|
-
@implementation
|
|
13
|
+
@implementation RNMGoogleMapWMSTile
|
|
14
14
|
|
|
15
15
|
-(id) init
|
|
16
16
|
{
|
package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.h → GoogleMaps/RNMGoogleMapWMSTileManager.h}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMGoogleMapWMSTileManager.h
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
#import <Foundation/Foundation.h>
|
|
12
12
|
#import <React/RCTViewManager.h>
|
|
13
13
|
|
|
14
|
-
@interface
|
|
14
|
+
@interface RNMGoogleMapWMSTileManager : RCTViewManager
|
|
15
15
|
@end
|
|
16
16
|
|
|
17
17
|
#endif
|
package/ios/{AirGoogleMaps/AIRGoogleMapWMSTileManager.m → GoogleMaps/RNMGoogleMapWMSTileManager.m}
RENAMED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//
|
|
2
|
-
//
|
|
3
|
-
//
|
|
2
|
+
// RNMGoogleMapWMSTileManager.m
|
|
3
|
+
// RNMaps
|
|
4
4
|
//
|
|
5
5
|
// Created by nizam on 10/28/18.
|
|
6
6
|
// Copyright © 2018. All rights reserved.
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
|
|
9
9
|
#ifdef HAVE_GOOGLE_MAPS
|
|
10
10
|
|
|
11
|
-
#import "
|
|
12
|
-
#import "
|
|
11
|
+
#import "RNMGoogleMapWMSTileManager.h"
|
|
12
|
+
#import "RNMGoogleMapWMSTile.h"
|
|
13
13
|
|
|
14
|
-
@interface
|
|
14
|
+
@interface RNMGoogleMapWMSTileManager()
|
|
15
15
|
|
|
16
16
|
@end
|
|
17
17
|
|
|
18
|
-
@implementation
|
|
18
|
+
@implementation RNMGoogleMapWMSTileManager
|
|
19
19
|
|
|
20
|
-
RCT_EXPORT_MODULE()
|
|
20
|
+
RCT_EXPORT_MODULE(RNMGoogleMapWMSTile)
|
|
21
21
|
|
|
22
22
|
- (UIView *)view
|
|
23
23
|
{
|
|
24
|
-
|
|
24
|
+
RNMGoogleMapWMSTile *tileLayer = [RNMGoogleMapWMSTile new];
|
|
25
25
|
return tileLayer;
|
|
26
26
|
}
|
|
27
27
|
|
|
@@ -176,11 +176,11 @@ extern NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView;
|
|
|
176
176
|
- (void)calloutViewClicked:(SMCalloutView *)calloutView;
|
|
177
177
|
|
|
178
178
|
/**
|
|
179
|
-
Called when the callout view detects that it will be outside the constrained view when it appears,
|
|
180
|
-
or if the target rect was already outside the constrained view. You can implement this selector
|
|
179
|
+
Called when the callout view detects that it will be outside the constrained view when it appears,
|
|
180
|
+
or if the target rect was already outside the constrained view. You can implement this selector
|
|
181
181
|
to respond to this situation by repositioning your content first in order to make everything visible.
|
|
182
|
-
The @c CGSize passed is the calculated offset necessary to make everything visible (plus a nice margin).
|
|
183
|
-
It expects you to return the amount of time you need to reposition things so the popup can be delayed.
|
|
182
|
+
The @c CGSize passed is the calculated offset necessary to make everything visible (plus a nice margin).
|
|
183
|
+
It expects you to return the amount of time you need to reposition things so the popup can be delayed.
|
|
184
184
|
Typically you would return @c kSMCalloutViewRepositionDelayForUIScrollView if you're repositioning by calling @c [UIScrollView @c setContentOffset:animated:].
|
|
185
185
|
|
|
186
186
|
@param calloutView the @c SMCalloutView to reposition
|
|
@@ -3,12 +3,12 @@
|
|
|
3
3
|
// Copyright (c) 2015 Facebook. All rights reserved.
|
|
4
4
|
//
|
|
5
5
|
|
|
6
|
-
#import "RCTConvert+
|
|
6
|
+
#import "RCTConvert+RNMMap.h"
|
|
7
7
|
|
|
8
8
|
#import <React/RCTConvert+CoreLocation.h>
|
|
9
|
-
#import "
|
|
9
|
+
#import "RNMMapCoordinate.h"
|
|
10
10
|
|
|
11
|
-
@implementation RCTConvert (
|
|
11
|
+
@implementation RCTConvert (RNMMap)
|
|
12
12
|
|
|
13
13
|
+ (MKCoordinateSpan)MKCoordinateSpan:(id)json
|
|
14
14
|
{
|
|
@@ -71,18 +71,18 @@ RCT_ENUM_CONVERTER(MKMapType, (@{
|
|
|
71
71
|
// around a `CLLocationCoordinate2D`, since I was unable to figure out
|
|
72
72
|
// how to handle an array of structs like CLLocationCoordinate2D. Would love
|
|
73
73
|
// to get rid of this if someone can show me how...
|
|
74
|
-
+ (
|
|
74
|
+
+ (RNMMapCoordinate *)RNMMapCoordinate:(id)json
|
|
75
75
|
{
|
|
76
|
-
|
|
76
|
+
RNMMapCoordinate *coord = [RNMMapCoordinate new];
|
|
77
77
|
coord.coordinate = [self CLLocationCoordinate2D:json];
|
|
78
78
|
return coord;
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
RCT_ARRAY_CONVERTER(
|
|
81
|
+
RCT_ARRAY_CONVERTER(RNMMapCoordinate)
|
|
82
82
|
|
|
83
|
-
+ (NSArray<NSArray<
|
|
83
|
+
+ (NSArray<NSArray<RNMMapCoordinate *> *> *)RNMMapCoordinateArrayArray:(id)json
|
|
84
84
|
{
|
|
85
|
-
return RCTConvertArrayValue(@selector(
|
|
85
|
+
return RCTConvertArrayValue(@selector(RNMMapCoordinateArray:), json);
|
|
86
86
|
}
|
|
87
87
|
|
|
88
88
|
@end
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
|
|
13
13
|
#import <React/RCTComponent.h>
|
|
14
14
|
#import "SMCalloutView.h"
|
|
15
|
-
#import "RCTConvert+
|
|
16
|
-
#import "
|
|
15
|
+
#import "RCTConvert+RNMMap.h"
|
|
16
|
+
#import "RNMMapCalloutSubview.h"
|
|
17
17
|
|
|
18
|
-
@class
|
|
18
|
+
@class RNMMapMarker;
|
|
19
19
|
|
|
20
|
-
extern const NSTimeInterval
|
|
21
|
-
extern const CGFloat
|
|
22
|
-
extern const NSInteger
|
|
20
|
+
extern const NSTimeInterval RNMMapRegionChangeObserveInterval;
|
|
21
|
+
extern const CGFloat RNMMapZoomBoundBuffer;
|
|
22
|
+
extern const NSInteger RNMMapMaxZoomLevel;
|
|
23
23
|
|
|
24
|
-
@interface
|
|
24
|
+
@interface RNMMap: MKMapView<SMCalloutViewDelegate>
|
|
25
25
|
|
|
26
26
|
@property (nonatomic, strong) SMCalloutView *calloutView;
|
|
27
27
|
@property (nonatomic, strong) UIImageView *cacheImageView;
|
|
@@ -73,7 +73,7 @@ extern const NSInteger AIRMapMaxZoomLevel;
|
|
|
73
73
|
- (void)finishLoading;
|
|
74
74
|
- (NSArray *)getMapBoundaries;
|
|
75
75
|
|
|
76
|
-
- (
|
|
76
|
+
- (RNMMapMarker*) markerAtPoint:(CGPoint)point;
|
|
77
77
|
- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible;
|
|
78
78
|
|
|
79
79
|
@end
|
|
@@ -7,23 +7,23 @@
|
|
|
7
7
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
8
8
|
*/
|
|
9
9
|
|
|
10
|
-
#import "
|
|
10
|
+
#import "RNMMap.h"
|
|
11
11
|
|
|
12
12
|
#import <React/RCTEventDispatcher.h>
|
|
13
13
|
#import <React/UIView+React.h>
|
|
14
|
-
#import "
|
|
15
|
-
#import "
|
|
16
|
-
#import "
|
|
17
|
-
#import "
|
|
14
|
+
#import "RNMMapMarker.h"
|
|
15
|
+
#import "RNMMapPolyline.h"
|
|
16
|
+
#import "RNMMapPolygon.h"
|
|
17
|
+
#import "RNMMapCircle.h"
|
|
18
18
|
#import <QuartzCore/QuartzCore.h>
|
|
19
|
-
#import "
|
|
20
|
-
#import "
|
|
21
|
-
#import "
|
|
22
|
-
#import "
|
|
19
|
+
#import "RNMMapUrlTile.h"
|
|
20
|
+
#import "RNMMapWMSTile.h"
|
|
21
|
+
#import "RNMMapLocalTile.h"
|
|
22
|
+
#import "RNMMapOverlay.h"
|
|
23
23
|
|
|
24
|
-
const NSTimeInterval
|
|
25
|
-
const CGFloat
|
|
26
|
-
const NSInteger
|
|
24
|
+
const NSTimeInterval RNMMapRegionChangeObserveInterval = 0.1;
|
|
25
|
+
const CGFloat RNMMapZoomBoundBuffer = 0.01;
|
|
26
|
+
const NSInteger RNMMapMaxZoomLevel = 20;
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
@interface MKMapView (UIGestureRecognizer)
|
|
@@ -33,7 +33,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
33
33
|
|
|
34
34
|
@end
|
|
35
35
|
|
|
36
|
-
@interface
|
|
36
|
+
@interface RNMMap ()
|
|
37
37
|
|
|
38
38
|
@property (nonatomic, strong) UIActivityIndicatorView *activityIndicatorView;
|
|
39
39
|
@property (nonatomic, assign) NSNumber *shouldZoomEnabled;
|
|
@@ -44,7 +44,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
44
44
|
|
|
45
45
|
@end
|
|
46
46
|
|
|
47
|
-
@implementation
|
|
47
|
+
@implementation RNMMap
|
|
48
48
|
{
|
|
49
49
|
UIView *_legalLabel;
|
|
50
50
|
BOOL _initialRegionSet;
|
|
@@ -52,7 +52,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
52
52
|
|
|
53
53
|
// Array to manually track RN subviews
|
|
54
54
|
//
|
|
55
|
-
//
|
|
55
|
+
// RNMMap implicitly creates subviews that aren't regular RN children
|
|
56
56
|
// (SMCalloutView injects an overlay subview), which otherwise confuses RN
|
|
57
57
|
// during component re-renders:
|
|
58
58
|
// https://github.com/facebook/react-native/blob/v0.16.0/React/Modules/RCTUIManager.m#L657
|
|
@@ -84,14 +84,14 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
84
84
|
self.calloutView.delegate = self;
|
|
85
85
|
|
|
86
86
|
self.minZoomLevel = 0;
|
|
87
|
-
self.maxZoomLevel =
|
|
87
|
+
self.maxZoomLevel = RNMMapMaxZoomLevel;
|
|
88
88
|
self.compassOffset = CGPointMake(0, 0);
|
|
89
89
|
}
|
|
90
90
|
return self;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
-(void)addSubview:(UIView *)view {
|
|
94
|
-
if([view isKindOfClass:[
|
|
94
|
+
if([view isKindOfClass:[RNMMapMarker class]]) {
|
|
95
95
|
[self addAnnotation:(id <MKAnnotation>)view];
|
|
96
96
|
} else {
|
|
97
97
|
[super addSubview:view];
|
|
@@ -103,28 +103,28 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
103
103
|
- (void)insertReactSubview:(id<RCTComponent>)subview atIndex:(NSInteger)atIndex {
|
|
104
104
|
// Our desired API is to pass up markers/overlays as children to the mapview component.
|
|
105
105
|
// This is where we intercept them and do the appropriate underlying mapview action.
|
|
106
|
-
if ([subview isKindOfClass:[
|
|
106
|
+
if ([subview isKindOfClass:[RNMMapMarker class]]) {
|
|
107
107
|
[self addAnnotation:(id <MKAnnotation>) subview];
|
|
108
|
-
} else if ([subview isKindOfClass:[
|
|
109
|
-
((
|
|
108
|
+
} else if ([subview isKindOfClass:[RNMMapPolyline class]]) {
|
|
109
|
+
((RNMMapPolyline *)subview).map = self;
|
|
110
110
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
111
|
-
} else if ([subview isKindOfClass:[
|
|
112
|
-
((
|
|
111
|
+
} else if ([subview isKindOfClass:[RNMMapPolygon class]]) {
|
|
112
|
+
((RNMMapPolygon *)subview).map = self;
|
|
113
113
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
114
|
-
} else if ([subview isKindOfClass:[
|
|
115
|
-
((
|
|
114
|
+
} else if ([subview isKindOfClass:[RNMMapCircle class]]) {
|
|
115
|
+
((RNMMapCircle *)subview).map = self;
|
|
116
116
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
117
|
-
} else if ([subview isKindOfClass:[
|
|
118
|
-
((
|
|
117
|
+
} else if ([subview isKindOfClass:[RNMMapUrlTile class]]) {
|
|
118
|
+
((RNMMapUrlTile *)subview).map = self;
|
|
119
119
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
120
|
-
}else if ([subview isKindOfClass:[
|
|
121
|
-
((
|
|
120
|
+
}else if ([subview isKindOfClass:[RNMMapWMSTile class]]) {
|
|
121
|
+
((RNMMapWMSTile *)subview).map = self;
|
|
122
122
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
123
|
-
} else if ([subview isKindOfClass:[
|
|
124
|
-
((
|
|
123
|
+
} else if ([subview isKindOfClass:[RNMMapLocalTile class]]) {
|
|
124
|
+
((RNMMapLocalTile *)subview).map = self;
|
|
125
125
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
126
|
-
} else if ([subview isKindOfClass:[
|
|
127
|
-
((
|
|
126
|
+
} else if ([subview isKindOfClass:[RNMMapOverlay class]]) {
|
|
127
|
+
((RNMMapOverlay *)subview).map = self;
|
|
128
128
|
[self addOverlay:(id<MKOverlay>)subview];
|
|
129
129
|
} else {
|
|
130
130
|
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
@@ -141,21 +141,21 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
141
141
|
- (void)removeReactSubview:(id<RCTComponent>)subview {
|
|
142
142
|
// similarly, when the children are being removed we have to do the appropriate
|
|
143
143
|
// underlying mapview action here.
|
|
144
|
-
if ([subview isKindOfClass:[
|
|
144
|
+
if ([subview isKindOfClass:[RNMMapMarker class]]) {
|
|
145
145
|
[self removeAnnotation:(id<MKAnnotation>)subview];
|
|
146
|
-
} else if ([subview isKindOfClass:[
|
|
146
|
+
} else if ([subview isKindOfClass:[RNMMapPolyline class]]) {
|
|
147
147
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
148
|
-
} else if ([subview isKindOfClass:[
|
|
148
|
+
} else if ([subview isKindOfClass:[RNMMapPolygon class]]) {
|
|
149
149
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
150
|
-
} else if ([subview isKindOfClass:[
|
|
150
|
+
} else if ([subview isKindOfClass:[RNMMapCircle class]]) {
|
|
151
151
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
152
|
-
} else if ([subview isKindOfClass:[
|
|
152
|
+
} else if ([subview isKindOfClass:[RNMMapUrlTile class]]) {
|
|
153
153
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
154
|
-
} else if ([subview isKindOfClass:[
|
|
154
|
+
} else if ([subview isKindOfClass:[RNMMapWMSTile class]]) {
|
|
155
155
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
156
|
-
} else if ([subview isKindOfClass:[
|
|
156
|
+
} else if ([subview isKindOfClass:[RNMMapLocalTile class]]) {
|
|
157
157
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
158
|
-
} else if ([subview isKindOfClass:[
|
|
158
|
+
} else if ([subview isKindOfClass:[RNMMapOverlay class]]) {
|
|
159
159
|
[self removeOverlay:(id <MKOverlay>) subview];
|
|
160
160
|
} else {
|
|
161
161
|
NSArray<id<RCTComponent>> *childSubviews = [subview reactSubviews];
|
|
@@ -178,17 +178,17 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
178
178
|
|
|
179
179
|
- (NSArray*) markers {
|
|
180
180
|
NSPredicate *filterMarkers = [NSPredicate predicateWithBlock:^BOOL(id evaluatedObject, NSDictionary *bindings) {
|
|
181
|
-
|
|
182
|
-
return [marker isKindOfClass:[
|
|
181
|
+
RNMMapMarker *marker = (RNMMapMarker *)evaluatedObject;
|
|
182
|
+
return [marker isKindOfClass:[RNMMapMarker class]];
|
|
183
183
|
}];
|
|
184
184
|
NSArray *filteredMarkers = [self.annotations filteredArrayUsingPredicate:filterMarkers];
|
|
185
185
|
return filteredMarkers;
|
|
186
186
|
}
|
|
187
187
|
|
|
188
|
-
- (
|
|
189
|
-
|
|
188
|
+
- (RNMMapMarker*) markerForCallout:(RNMMapCallout*)callout {
|
|
189
|
+
RNMMapMarker* marker = nil;
|
|
190
190
|
NSArray* markers = [self markers];
|
|
191
|
-
for (
|
|
191
|
+
for (RNMMapMarker* mrk in markers) {
|
|
192
192
|
if (mrk.calloutView == callout) {
|
|
193
193
|
marker = mrk;
|
|
194
194
|
break;
|
|
@@ -197,7 +197,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
197
197
|
return marker;
|
|
198
198
|
}
|
|
199
199
|
|
|
200
|
-
- (CGRect) frameForMarker:(
|
|
200
|
+
- (CGRect) frameForMarker:(RNMMapMarker*) mrkAnn {
|
|
201
201
|
MKAnnotationView* mrkView = [self viewForAnnotation: mrkAnn];
|
|
202
202
|
CGRect mrkFrame = mrkView.frame;
|
|
203
203
|
return mrkFrame;
|
|
@@ -205,7 +205,7 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
205
205
|
|
|
206
206
|
- (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible {
|
|
207
207
|
NSMutableDictionary* markersFrames = [NSMutableDictionary new];
|
|
208
|
-
for (
|
|
208
|
+
for (RNMMapMarker* mrkAnn in self.markers) {
|
|
209
209
|
CGRect frame = [self frameForMarker:mrkAnn];
|
|
210
210
|
CGPoint point = [self convertCoordinate:mrkAnn.coordinate toPointToView:self];
|
|
211
211
|
NSDictionary* frameDict = @{
|
|
@@ -227,9 +227,9 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
227
227
|
return markersFrames;
|
|
228
228
|
}
|
|
229
229
|
|
|
230
|
-
- (
|
|
231
|
-
|
|
232
|
-
for (
|
|
230
|
+
- (RNMMapMarker*) markerAtPoint:(CGPoint)point {
|
|
231
|
+
RNMMapMarker* mrk = nil;
|
|
232
|
+
for (RNMMapMarker* mrkAnn in self.markers) {
|
|
233
233
|
CGRect frame = [self frameForMarker:mrkAnn];
|
|
234
234
|
if (CGRectContainsPoint(frame, point)) {
|
|
235
235
|
mrk = mrkAnn;
|
|
@@ -260,17 +260,17 @@ const NSInteger AIRMapMaxZoomLevel = 20;
|
|
|
260
260
|
|
|
261
261
|
if (touchedView) {
|
|
262
262
|
UIWindow* win = [[[UIApplication sharedApplication] windows] firstObject];
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
263
|
+
RNMMapCalloutSubview* calloutSubview = nil;
|
|
264
|
+
RNMMapCallout* callout = nil;
|
|
265
|
+
RNMMapMarker* marker = nil;
|
|
266
266
|
|
|
267
267
|
UIView* tmp = touchedView;
|
|
268
268
|
while (tmp && tmp != win && tmp != self.calloutView) {
|
|
269
269
|
if ([tmp respondsToSelector:@selector(onPress)]) {
|
|
270
|
-
calloutSubview = (
|
|
270
|
+
calloutSubview = (RNMMapCalloutSubview*) tmp;
|
|
271
271
|
}
|
|
272
|
-
if ([tmp isKindOfClass:[
|
|
273
|
-
callout = (
|
|
272
|
+
if ([tmp isKindOfClass:[RNMMapCallout class]]) {
|
|
273
|
+
callout = (RNMMapCallout*) tmp;
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
tmp = tmp.superview;
|