Skip to content

Commit

Permalink
Add Marker rotation for Google Maps on iOS (react-native-maps#1326)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kerumen authored and patricio committed Sep 27, 2017
1 parent 6403c11 commit 2e7582c
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion docs/marker.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
| `calloutAnchor` | `Point` | | Specifies the point in the marker image at which to anchor the callout when it is displayed. This is specified in the same coordinate system as the anchor. See the `anchor` prop for more details.<br/><br/> The default is the top middle of the image.<br/><br/> For ios, see the `calloutOffset` prop.
| `flat` | `Boolean` | | Sets whether this marker should be flat against the map true or a billboard facing the camera false.
| `identifier` | `String` | | An identifier used to reference this marker at a later date.
| `rotation` | `Float` | | A float number indicating marker's rotation angle.
| `rotation` | `Float` | | A float number indicating marker's rotation angle, in degrees.
| `draggable` | `<null>` | | This is a non-value based prop. Adding this allows the marker to be draggable (re-positioned).

## Events
Expand Down
1 change: 1 addition & 0 deletions lib/ios/AirGoogleMaps/AIRGoogleMapMarker.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
@property (nonatomic, strong) AIRGoogleMapCallout *calloutView;
@property (nonatomic, strong) NSString *identifier;
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, assign) CLLocationDegrees rotation;
@property (nonatomic, strong) AIRGMSMarker* realMarker;
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
@property (nonatomic, copy) RCTDirectEventBlock onDragStart;
Expand Down
8 changes: 8 additions & 0 deletions lib/ios/AirGoogleMaps/AIRGoogleMapMarker.m
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,14 @@ - (CLLocationCoordinate2D)coordinate {
return _realMarker.position;
}

- (void)setRotation:(CLLocationDegrees)rotation {
_realMarker.rotation = rotation;
}

- (CLLocationDegrees)rotation {
return _realMarker.rotation;
}

- (void)setIdentifier:(NSString *)identifier {
_realMarker.identifier = identifier;
}
Expand Down
1 change: 1 addition & 0 deletions lib/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ - (UIView *)view

RCT_EXPORT_VIEW_PROPERTY(identifier, NSString)
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D)
RCT_EXPORT_VIEW_PROPERTY(rotation, CLLocationDegrees)
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString)
RCT_EXPORT_VIEW_PROPERTY(title, NSString)
Expand Down

0 comments on commit 2e7582c

Please sign in to comment.