mirror of
https://github.com/status-im/react-native-mapbox-gl.git
synced 2026-08-27 19:11:15 +00:00
update readme
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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;
|
||||
|
||||
|
||||
@@ -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];
|
||||
}
|
||||
|
||||
@@ -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];
|
||||
|
||||
Reference in New Issue
Block a user