From e6daec9f4c5a7337472a32a85a8beca080cf40f9 Mon Sep 17 00:00:00 2001 From: rsudekum Date: Sun, 14 Jun 2015 21:37:52 -0700 Subject: [PATCH] update readme --- API.md | 4 +++- RCTMapboxGL/RCTMapboxGL.h | 1 - RCTMapboxGL/RCTMapboxGL.m | 6 +++--- RCTMapboxGL/RCTMapboxGLManager.m | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/API.md b/API.md index 4274f7c..4f6ba14 100644 --- a/API.md +++ b/API.md @@ -17,10 +17,12 @@ | Event Name | Returns | Notes |---|---|---| -| `onRegionChange` | `{latitude: 0, longitude: 0, zoom: 0}` | Triggered by panning or zooming the map. +| `onRegionChange` | `{latitude: 0, longitude: 0, zoom: 0}` | Fired when the map ends panning or zooming. +| `onRegionWillChange` | `{latitude: 0, longitude: 0, zoom: 0}` | Fired when the map begins panning or zooming. | `onOpenAnnotation` | `{title: null, subtitle: null, latitude: 0, longitude: 0}` | Fired when focusing a an annotation. | `onUpdateUserLocation` | `{latitude: 0, longitude: 0, headingAccuracy: 0, magneticHeading: 0, trueHeading: 0, isUpdating: false}` | Fired when the users location updates. + ## Methods for Modifying the Map State These methods require you to use `MapboxGLMap.Mixin` to access the methods. Each method also requires you to pass in a string as the first argument which is equal to the `ref` on the map view you wish to modify. See the [example](https://github.com/bsudekum/react-native-mapbox-gl/blob/master/example.md) on how this is implemented. diff --git a/RCTMapboxGL/RCTMapboxGL.h b/RCTMapboxGL/RCTMapboxGL.h index b2662cf..a4c7c44 100644 --- a/RCTMapboxGL/RCTMapboxGL.h +++ b/RCTMapboxGL/RCTMapboxGL.h @@ -30,7 +30,6 @@ - (void)setDirectionAnimated:(int)heading; - (void)setCenterCoordinateAnimated:(CLLocationCoordinate2D)coordinates; - (void)setCenterCoordinateZoomLevelAnimated:(CLLocationCoordinate2D)coordinates zoomLevel:(double)zoomLevel; -- (void)addAnnotation:(NSArray *)annotation; - (void)selectAnnotationAnimated:(NSUInteger)annotationInArray; - (void)removeAnnotation:(NSUInteger)annotationInArray; diff --git a/RCTMapboxGL/RCTMapboxGL.m b/RCTMapboxGL/RCTMapboxGL.m index 0667b5b..509bd1f 100644 --- a/RCTMapboxGL/RCTMapboxGL.m +++ b/RCTMapboxGL/RCTMapboxGL.m @@ -63,9 +63,9 @@ RCT_EXPORT_MODULE(); _map.showsUserLocation = _showsUserLocation; _map.styleURL = _styleURL; _map.zoomLevel = _zoomLevel; + } else { /* A bit of a hack because hooking into the fully rendered event didn't seem to work */ [self performSelector:@selector(updateAnnotations) withObject:nil afterDelay:1]; - } else { /* We need to have a height/width specified in order to render */ if (_accessToken && _styleURL && self.bounds.size.height > 0 && self.bounds.size.width > 0) { [self createMap]; @@ -92,7 +92,7 @@ RCT_EXPORT_MODULE(); _map.frame = self.bounds; } -- (void)setAnnotations:(NSArray *)annotations +- (void)setAnnotations:(NSMutableArray *)annotations { _newAnnotations = annotations; [self performSelector:@selector(updateAnnotations) withObject:nil afterDelay:0.1]; @@ -106,7 +106,7 @@ RCT_EXPORT_MODULE(); [_map removeAnnotations: _annotations]; _annotations = nil; } - + _annotations = _newAnnotations; [_map addAnnotations:_newAnnotations]; } diff --git a/RCTMapboxGL/RCTMapboxGLManager.m b/RCTMapboxGL/RCTMapboxGLManager.m index 8a2efe2..2f87fd6 100644 --- a/RCTMapboxGL/RCTMapboxGLManager.m +++ b/RCTMapboxGL/RCTMapboxGLManager.m @@ -110,7 +110,7 @@ RCT_EXPORT_METHOD(removeAnnotation:(NSNumber *) reactTag } RCT_EXPORT_METHOD(addAnnotations:(NSNumber *)reactTag - annotations:(NSArray*) annotations) + annotations:(NSMutableArray *) annotations) { [_bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, RCTSparseArray *viewRegistry) { RCTMapboxGL *mapView = viewRegistry[reactTag];