Commit bc6ff3b7 authored by 7c00's avatar 7c00

Add iOS Marker clickEnabled and infoWindowDisabled props

ref #143
parent a4812c17
...@@ -16,10 +16,12 @@ ...@@ -16,10 +16,12 @@
BOOL _draggable; BOOL _draggable;
BOOL _active; BOOL _active;
BOOL _canShowCallout; BOOL _canShowCallout;
BOOL _enabled;
} }
- (instancetype)init { - (instancetype)init {
_annotation = [MAPointAnnotation new]; _annotation = [MAPointAnnotation new];
_enabled = YES;
_canShowCallout = YES; _canShowCallout = YES;
self = [super init]; self = [super init];
return self; return self;
...@@ -80,9 +82,14 @@ ...@@ -80,9 +82,14 @@
} }
} }
- (void)setDisabled:(BOOL)disabled { - (void)setInfoWindowDisabled:(BOOL)disabled {
_canShowCallout = !disabled; _canShowCallout = !disabled;
_annotationView.canShowCallout = _canShowCallout; _annotationView.canShowCallout = !disabled;
}
- (void)setClickDisabled:(BOOL)disabled {
_enabled = !disabled;
_annotationView.enabled = !disabled;
} }
- (MAPointAnnotation *)annotation { - (MAPointAnnotation *)annotation {
...@@ -110,6 +117,7 @@ ...@@ -110,6 +117,7 @@
_annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:_annotation reuseIdentifier:nil]; _annotationView = [[MAPinAnnotationView alloc] initWithAnnotation:_annotation reuseIdentifier:nil];
((MAPinAnnotationView *) _annotationView).pinColor = _pinColor; ((MAPinAnnotationView *) _annotationView).pinColor = _pinColor;
} }
_annotationView.enabled = _enabled;
_annotationView.canShowCallout = _canShowCallout; _annotationView.canShowCallout = _canShowCallout;
_annotationView.draggable = _draggable; _annotationView.draggable = _draggable;
_annotationView.customCalloutView = _calloutView; _annotationView.customCalloutView = _calloutView;
......
...@@ -21,7 +21,8 @@ RCT_EXPORT_VIEW_PROPERTY(title, NSString) ...@@ -21,7 +21,8 @@ RCT_EXPORT_VIEW_PROPERTY(title, NSString)
RCT_EXPORT_VIEW_PROPERTY(description, NSString) RCT_EXPORT_VIEW_PROPERTY(description, NSString)
RCT_EXPORT_VIEW_PROPERTY(active, BOOL) RCT_EXPORT_VIEW_PROPERTY(active, BOOL)
RCT_EXPORT_VIEW_PROPERTY(draggable, BOOL) RCT_EXPORT_VIEW_PROPERTY(draggable, BOOL)
RCT_EXPORT_VIEW_PROPERTY(disabled, BOOL) RCT_EXPORT_VIEW_PROPERTY(clickDisabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(infoWindowDisabled, BOOL)
RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger) RCT_EXPORT_VIEW_PROPERTY(zIndex, NSInteger)
RCT_EXPORT_VIEW_PROPERTY(color, MAPinAnnotationColor) RCT_EXPORT_VIEW_PROPERTY(color, MAPinAnnotationColor)
RCT_EXPORT_VIEW_PROPERTY(image, NSString) RCT_EXPORT_VIEW_PROPERTY(image, NSString)
......
...@@ -98,9 +98,14 @@ export default class Marker extends BaseComponent { ...@@ -98,9 +98,14 @@ export default class Marker extends BaseComponent {
active: PropTypes.bool, active: PropTypes.bool,
/** /**
* 是否禁用,禁用后不可点击 * 是否禁用点击,默认不禁用
*/ */
disabled: PropTypes.bool, clickDisabled: PropTypes.bool,
/**
* 是否禁用弹出窗口,默认不禁用
*/
infoWindowDisabled: PropTypes.bool,
/** /**
* 点击事件 * 点击事件
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment