-
Notifications
You must be signed in to change notification settings - Fork 694
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #421 from aksonov/master
support for custom annotation views
- Loading branch information
Showing
8 changed files
with
182 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#import "RCTMapboxAnnotation.h" | ||
|
||
#import <MapBox/MapBox.h> | ||
#import <UIKit/UIKit.h> | ||
|
||
#import "RCTConvert+MapKit.h" | ||
#import "RCTComponent.h" | ||
#import "RCTMapboxGL.h" | ||
|
||
@class RCTBridge; | ||
|
||
@interface RCTMapboxAnnotation : MGLAnnotationView <MGLAnnotation> | ||
|
||
@property (nonatomic, weak, nullable) RCTMapboxGL *map; | ||
@property (nonatomic, weak, nullable) RCTBridge *bridge; | ||
/** | ||
The center point (specified as a map coordinate) of the annotation. (required) | ||
(read-only) | ||
*/ | ||
@property (nonatomic) CLLocationCoordinate2D coordinate; | ||
|
||
/** | ||
The string containing the annotation’s title. | ||
Although this property is optional, if you support the selection of annotations | ||
in your map view, you are expected to provide this property. This string is | ||
displayed in the callout for the associated annotation. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *title; | ||
|
||
/** | ||
The string containing the annotation’s subtitle. | ||
This string is displayed in the callout for the associated annotation. | ||
*/ | ||
@property (nonatomic, copy, nullable) NSString *subtitle; | ||
|
||
|
||
@end | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "RCTMapboxAnnotation.h" | ||
|
||
#import "RCTEventDispatcher.h" | ||
#import "UIView+React.h" | ||
#import "RCTBridge.h" | ||
#import "RCTUtils.h" | ||
|
||
@implementation RCTMapboxAnnotation { | ||
} | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "RCTViewManager.h" | ||
|
||
@interface RCTMapboxAnnotationManager : RCTViewManager | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* Copyright (c) 2015-present, Facebook, Inc. | ||
* All rights reserved. | ||
* | ||
* This source code is licensed under the BSD-style license found in the | ||
* LICENSE file in the root directory of this source tree. An additional grant | ||
* of patent rights can be found in the PATENTS file in the same directory. | ||
*/ | ||
|
||
#import "RCTMapboxAnnotationManager.h" | ||
|
||
#import "RCTUIManager.h" | ||
#import "RCTConvert+CoreLocation.h" | ||
#import "UIView+React.h" | ||
#import "RCTMapboxAnnotation.h" | ||
|
||
@interface RCTMapboxAnnotationManager () <MGLMapViewDelegate> | ||
|
||
@end | ||
|
||
@implementation RCTMapboxAnnotationManager | ||
|
||
RCT_EXPORT_MODULE() | ||
|
||
- (UIView *)view | ||
{ | ||
RCTMapboxAnnotation *marker = [[RCTMapboxAnnotation alloc] init]; | ||
// UITapGestureRecognizer *tapGestureRecognizer = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(_handleTap:)]; | ||
// // setting this to NO allows the parent MapView to continue receiving marker selection events | ||
// tapGestureRecognizer.cancelsTouchesInView = NO; | ||
// [marker addGestureRecognizer:tapGestureRecognizer]; | ||
marker.bridge = self.bridge; | ||
return marker; | ||
} | ||
|
||
|
||
RCT_EXPORT_VIEW_PROPERTY(title, NSString) | ||
RCT_EXPORT_VIEW_PROPERTY(subtitle, NSString) | ||
RCT_EXPORT_VIEW_PROPERTY(coordinate, CLLocationCoordinate2D) | ||
|
||
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters