Skip to content

Commit 2e7582c

Browse files
Kerumenpatricio
authored and
patricio
committed
Add Marker rotation for Google Maps on iOS (react-native-maps#1326)
1 parent 6403c11 commit 2e7582c

File tree

4 files changed

+11
-1
lines changed

4 files changed

+11
-1
lines changed

docs/marker.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
| `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.
1616
| `flat` | `Boolean` | | Sets whether this marker should be flat against the map true or a billboard facing the camera false.
1717
| `identifier` | `String` | | An identifier used to reference this marker at a later date.
18-
| `rotation` | `Float` | | A float number indicating marker's rotation angle.
18+
| `rotation` | `Float` | | A float number indicating marker's rotation angle, in degrees.
1919
| `draggable` | `<null>` | | This is a non-value based prop. Adding this allows the marker to be draggable (re-positioned).
2020

2121
## Events

lib/ios/AirGoogleMaps/AIRGoogleMapMarker.h

+1
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
@property (nonatomic, strong) AIRGoogleMapCallout *calloutView;
1818
@property (nonatomic, strong) NSString *identifier;
1919
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
20+
@property (nonatomic, assign) CLLocationDegrees rotation;
2021
@property (nonatomic, strong) AIRGMSMarker* realMarker;
2122
@property (nonatomic, copy) RCTBubblingEventBlock onPress;
2223
@property (nonatomic, copy) RCTDirectEventBlock onDragStart;

lib/ios/AirGoogleMaps/AIRGoogleMapMarker.m

+8
Original file line numberDiff line numberDiff line change
@@ -157,6 +157,14 @@ - (CLLocationCoordinate2D)coordinate {
157157
return _realMarker.position;
158158
}
159159

160+
- (void)setRotation:(CLLocationDegrees)rotation {
161+
_realMarker.rotation = rotation;
162+
}
163+
164+
- (CLLocationDegrees)rotation {
165+
return _realMarker.rotation;
166+
}
167+
160168
- (void)setIdentifier:(NSString *)identifier {
161169
_realMarker.identifier = identifier;
162170
}

lib/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ - (UIView *)view
2828

2929
RCT_EXPORT_VIEW_PROPERTY(identifier, NSString)
3030
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D)
31+
RCT_EXPORT_VIEW_PROPERTY(rotation, CLLocationDegrees)
3132
RCT_EXPORT_VIEW_PROPERTY(onPress, RCTBubblingEventBlock)
3233
RCT_REMAP_VIEW_PROPERTY(image, imageSrc, NSString)
3334
RCT_EXPORT_VIEW_PROPERTY(title, NSString)

0 commit comments

Comments
 (0)