mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-22 19:48:56 +08:00
Add in support for showing annotation callouts by default without the user clicking on the pins
Reviewed By: mmmulani Differential Revision: D4209555 fbshipit-source-id: 38c2459f9bec0dd2279cf673bcb22aef15748347
This commit is contained in:
committed by
Facebook Github Bot
parent
7f0071ae58
commit
1835dbea7b
@@ -123,6 +123,13 @@ const MapView = React.createClass({
|
||||
*/
|
||||
showsCompass: React.PropTypes.bool,
|
||||
|
||||
/**
|
||||
* If `true` the map will show the callouts for all annotations without
|
||||
* the user having to click on the annotation.
|
||||
* Default value is `false`.
|
||||
*/
|
||||
showsAnnotationCallouts: React.PropTypes.bool,
|
||||
|
||||
/**
|
||||
* If `false` the user won't be able to pinch/zoom the map.
|
||||
* Default value is `true`.
|
||||
|
||||
@@ -21,6 +21,7 @@ RCT_EXTERN const CGFloat RCTMapZoomBoundBuffer;
|
||||
|
||||
@property (nonatomic, assign) BOOL followUserLocation;
|
||||
@property (nonatomic, assign) BOOL hasStartedRendering;
|
||||
@property (nonatomic, assign) BOOL showsAnnotationCallouts;
|
||||
@property (nonatomic, assign) CGFloat minDelta;
|
||||
@property (nonatomic, assign) CGFloat maxDelta;
|
||||
@property (nonatomic, assign) UIEdgeInsets legalLabelInsets;
|
||||
|
||||
@@ -85,6 +85,7 @@ RCT_EXPORT_MODULE()
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsUserLocation, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsPointsOfInterest, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsCompass, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(showsAnnotationCallouts, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(followUserLocation, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(zoomEnabled, BOOL)
|
||||
RCT_EXPORT_VIEW_PROPERTY(rotateEnabled, BOOL)
|
||||
@@ -289,6 +290,14 @@ RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RCTMap)
|
||||
return annotationView;
|
||||
}
|
||||
|
||||
- (void)mapView:(RCTMap *)mapView didAddAnnotationViews:(NSArray *)views {
|
||||
if (mapView.showsAnnotationCallouts) {
|
||||
for (id<MKAnnotation> annotation in mapView.annotations) {
|
||||
[mapView selectAnnotation:annotation animated:YES];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
- (MKOverlayRenderer *)mapView:(MKMapView *)mapView rendererForOverlay:(id<MKOverlay>)overlay
|
||||
{
|
||||
RCTAssert([overlay isKindOfClass:[RCTMapOverlay class]], @"Overlay must be of type RCTMapOverlay");
|
||||
|
||||
Reference in New Issue
Block a user