2015-03-23 20:28:42 +00:00
|
|
|
/**
|
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*/
|
2015-03-10 01:05:10 +00:00
|
|
|
|
|
|
|
#import <MapKit/MapKit.h>
|
|
|
|
#import <UIKit/UIKit.h>
|
|
|
|
|
2015-04-15 00:51:28 +00:00
|
|
|
#import "RCTConvert+MapKit.h"
|
Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.
This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.
The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.
RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)
If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 12:58:10 +00:00
|
|
|
#import "RCTComponent.h"
|
2015-04-15 00:51:28 +00:00
|
|
|
|
Add Polyline support to MapView
Summary: Per issue #1925, add support for Polyline to MapView.
Briefly, if you have a MapView declared as:
<MapView
annotations={this.state.annotations}
overlays={this.state.overlays}
style={styles.map}
region={this.state.region}
ref="mapView"
/>
then setting
this.state.overlays = [{
coordinates: [
{ latitude: 35.5, longitude: -5.5 },
{ latitude: 35.6, longitude: -5.6 },
...
],
strokeColor: 'rgba(255, 0, 0, 0.5)',
lineWidth: 3,
}];
will draw a red line between the points in locations with a width of 3 and equally blended with the background.
Closes https://github.com/facebook/react-native/pull/4153
Reviewed By: svcscm
Differential Revision: D2697347
Pulled By: nicklockwood
fb-gh-sync-id: a436e4ed8d4e43f2872b39b4694fad7c02de8fe5
2015-11-26 15:09:59 +00:00
|
|
|
RCT_EXTERN const CLLocationDegrees RCTMapDefaultSpan;
|
|
|
|
RCT_EXTERN const NSTimeInterval RCTMapRegionChangeObserveInterval;
|
|
|
|
RCT_EXTERN const CGFloat RCTMapZoomBoundBuffer;
|
2015-03-10 01:05:10 +00:00
|
|
|
|
|
|
|
@interface RCTMap: MKMapView
|
|
|
|
|
|
|
|
@property (nonatomic, assign) BOOL followUserLocation;
|
2015-05-07 23:20:08 +00:00
|
|
|
@property (nonatomic, assign) BOOL hasStartedRendering;
|
2015-03-10 01:05:10 +00:00
|
|
|
@property (nonatomic, assign) CGFloat minDelta;
|
|
|
|
@property (nonatomic, assign) CGFloat maxDelta;
|
|
|
|
@property (nonatomic, assign) UIEdgeInsets legalLabelInsets;
|
|
|
|
@property (nonatomic, strong) NSTimer *regionChangeObserveTimer;
|
Add Polyline support to MapView
Summary: Per issue #1925, add support for Polyline to MapView.
Briefly, if you have a MapView declared as:
<MapView
annotations={this.state.annotations}
overlays={this.state.overlays}
style={styles.map}
region={this.state.region}
ref="mapView"
/>
then setting
this.state.overlays = [{
coordinates: [
{ latitude: 35.5, longitude: -5.5 },
{ latitude: 35.6, longitude: -5.6 },
...
],
strokeColor: 'rgba(255, 0, 0, 0.5)',
lineWidth: 3,
}];
will draw a red line between the points in locations with a width of 3 and equally blended with the background.
Closes https://github.com/facebook/react-native/pull/4153
Reviewed By: svcscm
Differential Revision: D2697347
Pulled By: nicklockwood
fb-gh-sync-id: a436e4ed8d4e43f2872b39b4694fad7c02de8fe5
2015-11-26 15:09:59 +00:00
|
|
|
@property (nonatomic, copy) NSArray<NSString *> *annotationIDs;
|
|
|
|
@property (nonatomic, copy) NSArray<NSString *> *overlayIDs;
|
2015-03-10 01:05:10 +00:00
|
|
|
|
Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.
This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.
The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.
RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)
If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 12:58:10 +00:00
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onChange;
|
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
|
2016-01-04 14:37:15 +00:00
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationDragStateChange;
|
2016-01-29 14:25:35 +00:00
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationFocus;
|
|
|
|
@property (nonatomic, copy) RCTBubblingEventBlock onAnnotationBlur;
|
Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.
This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.
The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.
RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)
If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 12:58:10 +00:00
|
|
|
|
2015-12-17 14:45:53 +00:00
|
|
|
- (void)setAnnotations:(NSArray<RCTMapAnnotation *> *)annotations;
|
|
|
|
- (void)setOverlays:(NSArray<RCTMapOverlay *> *)overlays;
|
2015-04-15 00:51:28 +00:00
|
|
|
|
2015-03-10 01:05:10 +00:00
|
|
|
@end
|