Skip to content

Commit

Permalink
Add map type property (standard, satellite, hybrid) to MapView.
Browse files Browse the repository at this point in the history
Summary:
Here is an example project demonstrating this pull request: [AKMapView](https://github.com/adamkrell/AKMapView)
Closes facebook#1503
Github Author: Adam Krell <[email protected]>

Test Plan: Imported from GitHub, without a `Test Plan:` line.
  • Loading branch information
Adam Krell authored and sahrens committed Jun 12, 2015
1 parent 8d6d0ec commit 373854a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 0 deletions.
13 changes: 13 additions & 0 deletions Libraries/Components/MapView/MapView.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,19 @@ var MapView = React.createClass({
*/
scrollEnabled: React.PropTypes.bool,

/**
* The map type to be displayed.
*
* - standard: standard road map (default)
* - satellite: satellite view
* - hybrid: satellite view with roads and points of interest overlayed
*/
mapType: React.PropTypes.oneOf([
'standard',
'satellite',
'hybrid',
]),

/**
* The region to be displayed by the map.
*
Expand Down
1 change: 1 addition & 0 deletions React/Views/RCTConvert+MapKit.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
+ (MKCoordinateSpan)MKCoordinateSpan:(id)json;
+ (MKCoordinateRegion)MKCoordinateRegion:(id)json;
+ (MKShape *)MKShape:(id)json;
+ (MKMapType)MKMapType:(id)json;

typedef NSArray MKShapeArray;
+ (MKShapeArray *)MKShapeArray:(id)json;
Expand Down
6 changes: 6 additions & 0 deletions React/Views/RCTConvert+MapKit.m
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,10 @@ + (MKShape *)MKShape:(id)json

RCT_ARRAY_CONVERTER(MKShape)

RCT_ENUM_CONVERTER(MKMapType, (@{
@"standard": @(MKMapTypeStandard),
@"satellite": @(MKMapTypeSatellite),
@"hybrid": @(MKMapTypeHybrid),
}), MKMapTypeStandard, integerValue)

@end
1 change: 1 addition & 0 deletions React/Views/RCTMapManager.m
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ - (UIView *)view
RCT_EXPORT_VIEW_PROPERTY(maxDelta, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(minDelta, CGFloat)
RCT_EXPORT_VIEW_PROPERTY(legalLabelInsets, UIEdgeInsets)
RCT_EXPORT_VIEW_PROPERTY(mapType, MKMapType)
RCT_EXPORT_VIEW_PROPERTY(annotations, MKShapeArray)
RCT_CUSTOM_VIEW_PROPERTY(region, MKCoordinateRegion, RCTMap)
{
Expand Down

0 comments on commit 373854a

Please sign in to comment.