1 /** 2 * Copyright (c) 2015-present, Facebook, Inc. 3 * All rights reserved. 4 * 5 * This source code is licensed under the BSD-style license found in the 6 * LICENSE file in the root directory of this source tree. An additional grant 7 * of patent rights can be found in the PATENTS file in the same directory. 8 */ 9 10 #import <MapKit/MapKit.h> 11 #import <UIKit/UIKit.h> 12 13 #import <React/RCTComponent.h> 14 #import "SMCalloutView.h" 15 #import "RCTConvert+AirMap.h" 16 #import "AIRMapCalloutSubview.h" 17 18 @class AIRMapMarker; 19 20 extern const NSTimeInterval AIRMapRegionChangeObserveInterval; 21 extern const CGFloat AIRMapZoomBoundBuffer; 22 extern const NSInteger AIRMapMaxZoomLevel; 23 24 @interface AIRMap: MKMapView<SMCalloutViewDelegate> 25 26 @property (nonatomic, strong) SMCalloutView *calloutView; 27 @property (nonatomic, strong) UIImageView *cacheImageView; 28 @property (nonatomic, strong) UIView *loadingView; 29 30 @property (nonatomic, copy) NSString *userLocationAnnotationTitle; 31 @property (nonatomic, assign) BOOL followUserLocation; 32 @property (nonatomic, assign) BOOL userLocationCalloutEnabled; 33 @property (nonatomic, assign) BOOL hasStartedRendering; 34 @property (nonatomic, assign) BOOL cacheEnabled; 35 @property (nonatomic, assign) BOOL loadingEnabled; 36 @property (nonatomic, strong) UIColor *loadingBackgroundColor; 37 @property (nonatomic, strong) UIColor *loadingIndicatorColor; 38 @property (nonatomic, assign) BOOL hasShownInitialLoading; 39 @property (nonatomic, assign) CGFloat minDelta; 40 @property (nonatomic, assign) CGFloat maxDelta; 41 @property (nonatomic, assign) UIEdgeInsets legalLabelInsets; 42 @property (nonatomic, assign) MKCoordinateRegion initialRegion; 43 @property (nonatomic, assign) MKMapCamera *initialCamera; 44 @property (nonatomic, assign) CGFloat minZoomLevel; 45 @property (nonatomic, assign) CGFloat maxZoomLevel; 46 @property (nonatomic, assign) CGPoint compassOffset; 47 @property (nonatomic, assign) UIEdgeInsets mapPadding; 48 49 @property (nonatomic, assign) CLLocationCoordinate2D pendingCenter; 50 @property (nonatomic, assign) MKCoordinateSpan pendingSpan; 51 52 53 @property (nonatomic, assign) BOOL ignoreRegionChanges; 54 55 @property (nonatomic, copy) RCTBubblingEventBlock onMapReady; 56 @property (nonatomic, copy) RCTBubblingEventBlock onChange; 57 @property (nonatomic, copy) RCTBubblingEventBlock onPress; 58 @property (nonatomic, copy) RCTBubblingEventBlock onPanDrag; 59 @property (nonatomic, copy) RCTBubblingEventBlock onDoublePress; 60 @property (nonatomic, copy) RCTBubblingEventBlock onLongPress; 61 @property (nonatomic, copy) RCTDirectEventBlock onMarkerPress; 62 @property (nonatomic, copy) RCTDirectEventBlock onMarkerSelect; 63 @property (nonatomic, copy) RCTDirectEventBlock onMarkerDeselect; 64 @property (nonatomic, copy) RCTDirectEventBlock onMarkerDragStart; 65 @property (nonatomic, copy) RCTDirectEventBlock onMarkerDrag; 66 @property (nonatomic, copy) RCTDirectEventBlock onMarkerDragEnd; 67 @property (nonatomic, copy) RCTDirectEventBlock onCalloutPress; 68 @property (nonatomic, copy) RCTDirectEventBlock onRegionChange; 69 @property (nonatomic, copy) RCTBubblingEventBlock onUserLocationChange; 70 71 - (void)cacheViewIfNeeded; 72 - (void)beginLoading; 73 - (void)finishLoading; 74 - (NSArray *)getMapBoundaries; 75 76 - (AIRMapMarker*) markerAtPoint:(CGPoint)point; 77 - (NSDictionary*) getMarkersFramesWithOnlyVisible:(BOOL)onlyVisible; 78 79 @end 80