react-native-maps 1.7.0 → 2.0.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -535,7 +535,7 @@ RCT_EXPORT_METHOD(getAddressFromCoordinates:(nonnull NSNumber *)reactTag
|
|
|
535
535
|
callback(@[error]);
|
|
536
536
|
return;
|
|
537
537
|
}
|
|
538
|
-
MKAnnotationView *pin = [[
|
|
538
|
+
MKAnnotationView *pin = [[MKMarkerAnnotationView alloc] initWithAnnotation:nil reuseIdentifier:nil];
|
|
539
539
|
|
|
540
540
|
UIImage *image = snapshot.image;
|
|
541
541
|
UIGraphicsBeginImageContextWithOptions(image.size, YES, image.scale);
|
|
@@ -840,7 +840,7 @@ static int kDragCenterContext;
|
|
|
840
840
|
if (![view.annotation isKindOfClass:[AIRMapMarker class]]) return;
|
|
841
841
|
AIRMapMarker *marker = (AIRMapMarker *)view.annotation;
|
|
842
842
|
|
|
843
|
-
BOOL isPinView = [view isKindOfClass:[
|
|
843
|
+
BOOL isPinView = [view isKindOfClass:[MKMarkerAnnotationView class]];
|
|
844
844
|
|
|
845
845
|
id event = @{
|
|
846
846
|
@"id": marker.identifier ?: @"unknown",
|
|
@@ -23,7 +23,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
23
23
|
@implementation AIRMapMarker {
|
|
24
24
|
BOOL _hasSetCalloutOffset;
|
|
25
25
|
RCTImageLoaderCancellationBlock _reloadImageCancellationBlock;
|
|
26
|
-
|
|
26
|
+
MKMarkerAnnotationView *_pinView;
|
|
27
27
|
BOOL _calloutIsOpen;
|
|
28
28
|
NSInteger _zIndexBeforeOpen;
|
|
29
29
|
}
|
|
@@ -82,20 +82,19 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
82
82
|
if ([self shouldUsePinView]) {
|
|
83
83
|
// In this case, we want to render a platform "default" marker.
|
|
84
84
|
if (_pinView == nil) {
|
|
85
|
-
_pinView = [[
|
|
85
|
+
_pinView = [[MKMarkerAnnotationView alloc] initWithAnnotation:self reuseIdentifier: nil];
|
|
86
86
|
[self addGestureRecognizerToView:_pinView];
|
|
87
87
|
_pinView.annotation = self;
|
|
88
88
|
}
|
|
89
89
|
|
|
90
90
|
_pinView.draggable = self.draggable;
|
|
91
91
|
_pinView.layer.zPosition = self.zIndex;
|
|
92
|
+
_pinView.markerTintColor = self.pinColor;
|
|
92
93
|
|
|
93
|
-
//
|
|
94
|
-
//
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
_pinView.pinTintColor = self.pinColor;
|
|
98
|
-
}
|
|
94
|
+
// Hiding title and subtitle to match behaviour of MKPinAnnotationView
|
|
95
|
+
// MKMarkerAnnotationView shows the title and subtitle underneath the marker
|
|
96
|
+
_pinView.titleVisibility = MKFeatureVisibilityHidden;
|
|
97
|
+
_pinView.subtitleVisibility = MKFeatureVisibilityHidden;
|
|
99
98
|
|
|
100
99
|
return _pinView;
|
|
101
100
|
} else {
|
|
@@ -114,7 +113,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
114
113
|
|
|
115
114
|
// Apply the MKAnnotationView's desired calloutOffset (from the top-middle of the view)
|
|
116
115
|
if ([self shouldUsePinView] && !_hasSetCalloutOffset) {
|
|
117
|
-
calloutView.calloutOffset = CGPointMake(
|
|
116
|
+
calloutView.calloutOffset = CGPointMake(0,-45);
|
|
118
117
|
} else {
|
|
119
118
|
calloutView.calloutOffset = self.calloutOffset;
|
|
120
119
|
}
|
|
@@ -336,9 +335,7 @@ NSInteger const AIR_CALLOUT_OPEN_ZINDEX_BASELINE = 999;
|
|
|
336
335
|
{
|
|
337
336
|
_pinColor = pinColor;
|
|
338
337
|
|
|
339
|
-
|
|
340
|
-
_pinView.pinTintColor = _pinColor;
|
|
341
|
-
}
|
|
338
|
+
_pinView.markerTintColor = _pinColor;
|
|
342
339
|
}
|
|
343
340
|
|
|
344
341
|
- (void)setZIndex:(NSInteger)zIndex
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
SMCalloutView
|
|
7
7
|
-------------
|
|
8
8
|
Created by Nick Farina (nfarina@gmail.com)
|
|
9
|
-
Version 2.1.
|
|
9
|
+
Version 2.1.5
|
|
10
10
|
|
|
11
11
|
*/
|
|
12
12
|
|
|
@@ -20,11 +20,11 @@ typedef NS_OPTIONS(NSUInteger, SMCalloutArrowDirection) {
|
|
|
20
20
|
/// options for the callout present/dismiss animation
|
|
21
21
|
typedef NS_ENUM(NSInteger, SMCalloutAnimation) {
|
|
22
22
|
/// the "bounce" animation we all know and love from @c UIAlertView
|
|
23
|
-
|
|
23
|
+
SMCalloutAnimationBounce,
|
|
24
24
|
/// a simple fade in or out
|
|
25
|
-
|
|
25
|
+
SMCalloutAnimationFade,
|
|
26
26
|
/// grow or shrink linearly, like in the iPad Calendar app
|
|
27
|
-
|
|
27
|
+
SMCalloutAnimationStretch
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
NS_ASSUME_NONNULL_BEGIN
|
|
@@ -40,6 +40,7 @@ extern NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView;
|
|
|
40
40
|
// Callout view.
|
|
41
41
|
//
|
|
42
42
|
|
|
43
|
+
// iOS 10+ expects CAAnimationDelegate to be set explicitly.
|
|
43
44
|
#if __IPHONE_OS_VERSION_MAX_ALLOWED < 100000
|
|
44
45
|
@interface SMCalloutView : UIView
|
|
45
46
|
#else
|
|
@@ -98,7 +98,11 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
98
98
|
self.titleLabel.opaque = NO;
|
|
99
99
|
self.titleLabel.backgroundColor = [UIColor clearColor];
|
|
100
100
|
self.titleLabel.font = [UIFont systemFontOfSize:17];
|
|
101
|
-
|
|
101
|
+
if (@available(iOS 13.0, *)) {
|
|
102
|
+
self.titleLabel.textColor = [UIColor labelColor];
|
|
103
|
+
} else {
|
|
104
|
+
self.titleLabel.textColor = [UIColor blackColor];
|
|
105
|
+
}
|
|
102
106
|
}
|
|
103
107
|
return self.titleLabel;
|
|
104
108
|
}
|
|
@@ -116,7 +120,11 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
116
120
|
self.subtitleLabel.opaque = NO;
|
|
117
121
|
self.subtitleLabel.backgroundColor = [UIColor clearColor];
|
|
118
122
|
self.subtitleLabel.font = [UIFont systemFontOfSize:12];
|
|
119
|
-
|
|
123
|
+
if (@available(iOS 13.0, *)) {
|
|
124
|
+
self.subtitleLabel.textColor = [UIColor secondaryLabelColor];
|
|
125
|
+
} else {
|
|
126
|
+
self.subtitleLabel.textColor = [UIColor blackColor];
|
|
127
|
+
}
|
|
120
128
|
}
|
|
121
129
|
return self.subtitleLabel;
|
|
122
130
|
}
|
|
@@ -156,24 +164,24 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
156
164
|
|
|
157
165
|
- (CGFloat)leftAccessoryVerticalMargin {
|
|
158
166
|
if (self.leftAccessoryView.frameHeight < self.calloutContainerHeight)
|
|
159
|
-
return
|
|
167
|
+
return round((self.calloutContainerHeight - self.leftAccessoryView.frameHeight) / 2);
|
|
160
168
|
else
|
|
161
169
|
return 0;
|
|
162
170
|
}
|
|
163
171
|
|
|
164
172
|
- (CGFloat)leftAccessoryHorizontalMargin {
|
|
165
|
-
return
|
|
173
|
+
return fmin(self.leftAccessoryVerticalMargin, TITLE_HMARGIN);
|
|
166
174
|
}
|
|
167
175
|
|
|
168
176
|
- (CGFloat)rightAccessoryVerticalMargin {
|
|
169
177
|
if (self.rightAccessoryView.frameHeight < self.calloutContainerHeight)
|
|
170
|
-
return
|
|
178
|
+
return round((self.calloutContainerHeight - self.rightAccessoryView.frameHeight) / 2);
|
|
171
179
|
else
|
|
172
180
|
return 0;
|
|
173
181
|
}
|
|
174
182
|
|
|
175
183
|
- (CGFloat)rightAccessoryHorizontalMargin {
|
|
176
|
-
return
|
|
184
|
+
return fmin(self.rightAccessoryVerticalMargin, TITLE_HMARGIN);
|
|
177
185
|
}
|
|
178
186
|
|
|
179
187
|
- (CGFloat)innerContentMarginLeft {
|
|
@@ -229,7 +237,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
229
237
|
else if (preferredTitleSize.width >= 0.000001 || preferredSubtitleSize.width >= 0.000001) {
|
|
230
238
|
|
|
231
239
|
// if we have a title or subtitle, then our assumed margins are valid, and we can apply them
|
|
232
|
-
preferredWidth =
|
|
240
|
+
preferredWidth = fmax(preferredTitleSize.width, preferredSubtitleSize.width) + margin;
|
|
233
241
|
}
|
|
234
242
|
else {
|
|
235
243
|
// ok we have no title or subtitle to speak of. In this case, the system callout would actually not display
|
|
@@ -241,18 +249,18 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
241
249
|
}
|
|
242
250
|
|
|
243
251
|
// ensure we're big enough to fit our graphics!
|
|
244
|
-
preferredWidth =
|
|
252
|
+
preferredWidth = fmax(preferredWidth, CALLOUT_MIN_WIDTH);
|
|
245
253
|
|
|
246
254
|
// ask to be smaller if we have space, otherwise we'll fit into what we have by truncating the title/subtitle.
|
|
247
|
-
return CGSizeMake(
|
|
255
|
+
return CGSizeMake(fmin(preferredWidth, size.width), self.calloutHeight);
|
|
248
256
|
}
|
|
249
257
|
|
|
250
258
|
- (CGSize)offsetToContainRect:(CGRect)innerRect inRect:(CGRect)outerRect {
|
|
251
|
-
CGFloat nudgeRight =
|
|
252
|
-
CGFloat nudgeLeft =
|
|
253
|
-
CGFloat nudgeTop =
|
|
254
|
-
CGFloat nudgeBottom =
|
|
255
|
-
return CGSizeMake(nudgeLeft ? nudgeLeft : nudgeRight, nudgeTop ? nudgeTop : nudgeBottom);
|
|
259
|
+
CGFloat nudgeRight = fmax(0, CGRectGetMinX(outerRect) - CGRectGetMinX(innerRect));
|
|
260
|
+
CGFloat nudgeLeft = fmin(0, CGRectGetMaxX(outerRect) - CGRectGetMaxX(innerRect));
|
|
261
|
+
CGFloat nudgeTop = fmax(0, CGRectGetMinY(outerRect) - CGRectGetMinY(innerRect));
|
|
262
|
+
CGFloat nudgeBottom = fmin(0, CGRectGetMaxY(outerRect) - CGRectGetMaxY(innerRect));
|
|
263
|
+
return CGSizeMake(nudgeLeft > 0 ? nudgeLeft : nudgeRight, nudgeTop > 0 ? nudgeTop : nudgeBottom);
|
|
256
264
|
}
|
|
257
265
|
|
|
258
266
|
- (void)presentCalloutFromRect:(CGRect)rect inView:(UIView *)view constrainedToView:(UIView *)constrainedView animated:(BOOL)animated {
|
|
@@ -269,8 +277,9 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
269
277
|
// Sanity check: dismiss this callout immediately if it's displayed somewhere
|
|
270
278
|
if (self.layer.superlayer) [self dismissCalloutAnimated:NO];
|
|
271
279
|
|
|
272
|
-
// cancel
|
|
280
|
+
// cancel all animations that may be in progress
|
|
273
281
|
[self.layer removeAnimationForKey:@"present"];
|
|
282
|
+
[self.layer removeAnimationForKey:@"dismiss"];
|
|
274
283
|
|
|
275
284
|
// figure out the constrained view's rect in our popup view's coordinate system
|
|
276
285
|
CGRect constrainedRect = [constrainedLayer convertRect:constrainedLayer.bounds toLayer:layer];
|
|
@@ -314,7 +323,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
314
323
|
CGFloat anchorY = self.calloutOffset.y + (bestDirection == SMCalloutArrowDirectionDown ? CGRectGetMinY(rect) : CGRectGetMaxY(rect));
|
|
315
324
|
|
|
316
325
|
// we prefer to sit centered directly above our anchor
|
|
317
|
-
CGFloat calloutX =
|
|
326
|
+
CGFloat calloutX = round(anchorX - self.frameWidth / 2);
|
|
318
327
|
|
|
319
328
|
// but not if it's going to get too close to the edge of our constraints
|
|
320
329
|
if (calloutX < constrainedRect.origin.x)
|
|
@@ -339,8 +348,8 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
339
348
|
[layer addSublayer:self.layer];
|
|
340
349
|
|
|
341
350
|
CGPoint calloutOrigin = {
|
|
342
|
-
|
|
343
|
-
|
|
351
|
+
.x = calloutX + adjustX,
|
|
352
|
+
.y = bestDirection == SMCalloutArrowDirectionDown ? (anchorY - self.calloutHeight) : anchorY
|
|
344
353
|
};
|
|
345
354
|
|
|
346
355
|
self.frameOrigin = calloutOrigin;
|
|
@@ -361,8 +370,8 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
361
370
|
|
|
362
371
|
// make sure our frame is not on half-pixels or else we may be blurry!
|
|
363
372
|
CGFloat scale = [UIScreen mainScreen].scale;
|
|
364
|
-
self.frameX =
|
|
365
|
-
self.frameY =
|
|
373
|
+
self.frameX = floor(self.frameX*scale)/scale;
|
|
374
|
+
self.frameY = floor(self.frameY*scale)/scale;
|
|
366
375
|
|
|
367
376
|
// layout now so we can immediately start animating to the final position if needed
|
|
368
377
|
[self setNeedsLayout];
|
|
@@ -480,7 +489,7 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
480
489
|
bounce.duration = 0.23;
|
|
481
490
|
bounce.fromValue = presenting ? @0.7 : @1.0;
|
|
482
491
|
bounce.toValue = presenting ? @1.0 : @0.7;
|
|
483
|
-
bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.
|
|
492
|
+
bounce.timingFunction = [CAMediaTimingFunction functionWithControlPoints:0.59367f:0.12066f:0.18878f:1.5814f];
|
|
484
493
|
|
|
485
494
|
CAAnimationGroup *group = [CAAnimationGroup animation];
|
|
486
495
|
group.animations = @[fade, bounce];
|
|
@@ -593,32 +602,72 @@ NSTimeInterval const kSMCalloutViewRepositionDelayForUIScrollView = 1.0/3.0;
|
|
|
593
602
|
@property (nonatomic, strong) UIImageView *arrowImageView, *arrowHighlightedImageView, *arrowBorderView;
|
|
594
603
|
@end
|
|
595
604
|
|
|
596
|
-
static UIImage *blackArrowImage = nil, *
|
|
605
|
+
static UIImage *blackArrowImage = nil, *normalArrowImageLight = nil, *normalArrowImageDark = nil, *highlightedArrowImageLight = nil, *highlightedArrowImageDark = nil, *arrowBorderImageLight = nil, *arrowBorderImageDark = nil;
|
|
606
|
+
static UIColor *normalBackgroundColor, *highlightedBackgroundColor, *borderColor;
|
|
597
607
|
|
|
598
608
|
@implementation SMCalloutMaskedBackgroundView
|
|
599
609
|
|
|
600
610
|
- (id)initWithFrame:(CGRect)frame {
|
|
601
611
|
if (self = [super initWithFrame:frame]) {
|
|
602
|
-
|
|
612
|
+
|
|
613
|
+
UIColor *normalBackgroundColorLight = [UIColor whiteColor];
|
|
614
|
+
UIColor *normalBackgroundColorDark = [UIColor colorWithWhite:0.2 alpha:1.0];
|
|
615
|
+
UIColor *highlightedBackgroundColorLight = [UIColor colorWithWhite:0.85 alpha:1];
|
|
616
|
+
UIColor *highlightedBackgroundColorDark = [UIColor colorWithWhite:0.15 alpha:1];
|
|
617
|
+
UIColor *borderColorLight = [UIColor colorWithWhite:0 alpha:0.2];
|
|
618
|
+
UIColor *borderColorDark = [UIColor colorWithWhite:1 alpha:0.2];
|
|
619
|
+
|
|
620
|
+
if (@available(iOS 13.0, *)) {
|
|
621
|
+
normalBackgroundColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
|
|
622
|
+
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
|
|
623
|
+
return normalBackgroundColorLight;
|
|
624
|
+
} else {
|
|
625
|
+
return normalBackgroundColorDark;
|
|
626
|
+
}
|
|
627
|
+
}];
|
|
628
|
+
highlightedBackgroundColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
|
|
629
|
+
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
|
|
630
|
+
return highlightedBackgroundColorLight;
|
|
631
|
+
} else {
|
|
632
|
+
return highlightedBackgroundColorDark;
|
|
633
|
+
}
|
|
634
|
+
}];
|
|
635
|
+
borderColor = [UIColor colorWithDynamicProvider:^UIColor * _Nonnull(UITraitCollection * _Nonnull traitCollection) {
|
|
636
|
+
if (traitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
|
|
637
|
+
return borderColorLight;
|
|
638
|
+
} else {
|
|
639
|
+
return borderColorDark;
|
|
640
|
+
}
|
|
641
|
+
}];
|
|
642
|
+
} else {
|
|
643
|
+
normalBackgroundColor = normalBackgroundColorLight;
|
|
644
|
+
highlightedBackgroundColor = highlightedBackgroundColorLight;
|
|
645
|
+
borderColor = borderColorLight;
|
|
646
|
+
}
|
|
647
|
+
|
|
603
648
|
// Here we're mimicking the very particular (and odd) structure of the system callout view.
|
|
604
649
|
// The hierarchy and view/layer values were discovered by inspecting map kit using Reveal.app
|
|
605
650
|
|
|
606
651
|
self.containerView = [UIView new];
|
|
607
|
-
self.containerView.backgroundColor =
|
|
652
|
+
self.containerView.backgroundColor = normalBackgroundColor;
|
|
608
653
|
self.containerView.alpha = 0.96;
|
|
609
654
|
self.containerView.layer.cornerRadius = 8;
|
|
610
|
-
self.
|
|
611
|
-
self.
|
|
655
|
+
self.layer.shadowRadius = 6;
|
|
656
|
+
self.layer.shadowOffset = CGSizeMake(0, 4);
|
|
657
|
+
self.layer.shadowOpacity = 0.1f;
|
|
612
658
|
|
|
613
659
|
self.containerBorderView = [UIView new];
|
|
614
|
-
self.containerBorderView.layer.borderColor = [UIColor colorWithWhite:0 alpha:0.1].CGColor;
|
|
615
660
|
self.containerBorderView.layer.borderWidth = 0.5;
|
|
616
661
|
self.containerBorderView.layer.cornerRadius = 8.5;
|
|
617
662
|
|
|
618
663
|
if (!blackArrowImage) {
|
|
619
664
|
blackArrowImage = [SMCalloutBackgroundView embeddedImageNamed:@"CalloutArrow"];
|
|
620
|
-
|
|
621
|
-
|
|
665
|
+
normalArrowImageLight = [self image:blackArrowImage withColor:normalBackgroundColorLight];
|
|
666
|
+
normalArrowImageDark = [self image:blackArrowImage withColor:normalBackgroundColorDark];
|
|
667
|
+
highlightedArrowImageLight = [self image:blackArrowImage withColor:highlightedBackgroundColorLight];
|
|
668
|
+
highlightedArrowImageDark = [self image:blackArrowImage withColor:highlightedBackgroundColorDark];
|
|
669
|
+
arrowBorderImageLight = [self image:blackArrowImage withColor:borderColorLight];
|
|
670
|
+
arrowBorderImageDark = [self image:blackArrowImage withColor:borderColorDark];
|
|
622
671
|
}
|
|
623
672
|
|
|
624
673
|
self.anchorHeight = 13;
|
|
@@ -626,12 +675,12 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
626
675
|
|
|
627
676
|
self.arrowView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, blackArrowImage.size.width, blackArrowImage.size.height)];
|
|
628
677
|
self.arrowView.alpha = 0.96;
|
|
629
|
-
self.arrowImageView = [[UIImageView alloc] initWithImage:
|
|
630
|
-
self.arrowHighlightedImageView = [[UIImageView alloc] initWithImage:
|
|
678
|
+
self.arrowImageView = [[UIImageView alloc] initWithImage:normalArrowImageLight];
|
|
679
|
+
self.arrowHighlightedImageView = [[UIImageView alloc] initWithImage:highlightedArrowImageLight];
|
|
631
680
|
self.arrowHighlightedImageView.hidden = YES;
|
|
632
|
-
self.arrowBorderView = [[UIImageView alloc] initWithImage:
|
|
633
|
-
self.arrowBorderView.alpha = 0.1;
|
|
681
|
+
self.arrowBorderView = [[UIImageView alloc] initWithImage:arrowBorderImageLight];
|
|
634
682
|
self.arrowBorderView.frameY = 0.5;
|
|
683
|
+
[self updateColors];
|
|
635
684
|
|
|
636
685
|
[self addSubview:self.containerView];
|
|
637
686
|
[self.containerView addSubview:self.containerBorderView];
|
|
@@ -651,7 +700,7 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
651
700
|
|
|
652
701
|
- (void)setHighlighted:(BOOL)highlighted {
|
|
653
702
|
[super setHighlighted:highlighted];
|
|
654
|
-
self.containerView.backgroundColor = highlighted ?
|
|
703
|
+
self.containerView.backgroundColor = highlighted ? highlightedBackgroundColor : normalBackgroundColor;
|
|
655
704
|
self.arrowImageView.hidden = highlighted;
|
|
656
705
|
self.arrowHighlightedImageView.hidden = !highlighted;
|
|
657
706
|
}
|
|
@@ -681,7 +730,7 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
681
730
|
self.containerView.frame = CGRectMake(0, dy, self.frameWidth, self.frameHeight - self.arrowView.frameHeight + 0.5);
|
|
682
731
|
self.containerBorderView.frame = CGRectInset(self.containerView.bounds, -0.5, -0.5);
|
|
683
732
|
|
|
684
|
-
self.arrowView.frameX =
|
|
733
|
+
self.arrowView.frameX = round(self.arrowPoint.x - self.arrowView.frameWidth / 2);
|
|
685
734
|
|
|
686
735
|
if (pointingUp) {
|
|
687
736
|
self.arrowView.frameY = 1;
|
|
@@ -693,6 +742,33 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
693
742
|
}
|
|
694
743
|
}
|
|
695
744
|
|
|
745
|
+
- (void)traitCollectionDidChange:(UITraitCollection *)previousTraitCollection {
|
|
746
|
+
[super traitCollectionDidChange:previousTraitCollection];
|
|
747
|
+
[self updateColors];
|
|
748
|
+
}
|
|
749
|
+
|
|
750
|
+
- (void)updateColors {
|
|
751
|
+
if (@available(iOS 13.0, *)) {
|
|
752
|
+
[self.traitCollection performAsCurrentTraitCollection:^{
|
|
753
|
+
if (UITraitCollection.currentTraitCollection.userInterfaceStyle == UIUserInterfaceStyleLight) {
|
|
754
|
+
self.arrowImageView.image = normalArrowImageLight;
|
|
755
|
+
self.arrowHighlightedImageView.image = highlightedArrowImageLight;
|
|
756
|
+
self.arrowBorderView.image = arrowBorderImageLight;
|
|
757
|
+
} else {
|
|
758
|
+
self.arrowImageView.image = normalArrowImageDark;
|
|
759
|
+
self.arrowHighlightedImageView.image = highlightedArrowImageDark;
|
|
760
|
+
self.arrowBorderView.image = arrowBorderImageDark;
|
|
761
|
+
}
|
|
762
|
+
self.containerBorderView.layer.borderColor = borderColor.CGColor;
|
|
763
|
+
}];
|
|
764
|
+
} else {
|
|
765
|
+
self.arrowImageView.image = normalArrowImageLight;
|
|
766
|
+
self.arrowHighlightedImageView.image = highlightedArrowImageLight;
|
|
767
|
+
self.arrowBorderView.image = arrowBorderImageLight;
|
|
768
|
+
self.containerBorderView.layer.borderColor = borderColor.CGColor;
|
|
769
|
+
}
|
|
770
|
+
}
|
|
771
|
+
|
|
696
772
|
- (CALayer *)contentMask {
|
|
697
773
|
|
|
698
774
|
UIGraphicsBeginImageContextWithOptions(self.bounds.size, NO, 0);
|
|
@@ -712,83 +788,6 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
712
788
|
|
|
713
789
|
@implementation SMCalloutBackgroundView
|
|
714
790
|
|
|
715
|
-
+ (NSData *)dataWithBase64EncodedString:(NSString *)string {
|
|
716
|
-
//
|
|
717
|
-
// NSData+Base64.m
|
|
718
|
-
//
|
|
719
|
-
// Version 1.0.2
|
|
720
|
-
//
|
|
721
|
-
// Created by Nick Lockwood on 12/01/2012.
|
|
722
|
-
// Copyright (C) 2012 Charcoal Design
|
|
723
|
-
//
|
|
724
|
-
// Distributed under the permissive zlib License
|
|
725
|
-
// Get the latest version from here:
|
|
726
|
-
//
|
|
727
|
-
// https://github.com/nicklockwood/Base64
|
|
728
|
-
//
|
|
729
|
-
// This software is provided 'as-is', without any express or implied
|
|
730
|
-
// warranty. In no event will the authors be held liable for any damages
|
|
731
|
-
// arising from the use of this software.
|
|
732
|
-
//
|
|
733
|
-
// Permission is granted to anyone to use this software for any purpose,
|
|
734
|
-
// including commercial applications, and to alter it and redistribute it
|
|
735
|
-
// freely, subject to the following restrictions:
|
|
736
|
-
//
|
|
737
|
-
// 1. The origin of this software must not be misrepresented; you must not
|
|
738
|
-
// claim that you wrote the original software. If you use this software
|
|
739
|
-
// in a product, an acknowledgment in the product documentation would be
|
|
740
|
-
// appreciated but is not required.
|
|
741
|
-
//
|
|
742
|
-
// 2. Altered source versions must be plainly marked as such, and must not be
|
|
743
|
-
// misrepresented as being the original software.
|
|
744
|
-
//
|
|
745
|
-
// 3. This notice may not be removed or altered from any source distribution.
|
|
746
|
-
//
|
|
747
|
-
const char lookup[] = {
|
|
748
|
-
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
|
749
|
-
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99,
|
|
750
|
-
99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 99, 62, 99, 99, 99, 63,
|
|
751
|
-
52, 53, 54, 55, 56, 57, 58, 59, 60, 61, 99, 99, 99, 99, 99, 99,
|
|
752
|
-
99, 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
|
|
753
|
-
15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 99, 99, 99, 99, 99,
|
|
754
|
-
99, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40,
|
|
755
|
-
41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 99, 99, 99, 99, 99
|
|
756
|
-
};
|
|
757
|
-
|
|
758
|
-
NSData *inputData = [string dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
|
|
759
|
-
long long inputLength = [inputData length];
|
|
760
|
-
const unsigned char *inputBytes = [inputData bytes];
|
|
761
|
-
|
|
762
|
-
long long maxOutputLength = (inputLength / 4 + 1) * 3;
|
|
763
|
-
NSMutableData *outputData = [NSMutableData dataWithLength:(NSUInteger)maxOutputLength];
|
|
764
|
-
unsigned char *outputBytes = (unsigned char *)[outputData mutableBytes];
|
|
765
|
-
|
|
766
|
-
int accumulator = 0;
|
|
767
|
-
long long outputLength = 0;
|
|
768
|
-
unsigned char accumulated[] = {0, 0, 0, 0};
|
|
769
|
-
for (long long i = 0; i < inputLength; i++) {
|
|
770
|
-
unsigned char decoded = lookup[inputBytes[i] & 0x7F];
|
|
771
|
-
if (decoded != 99) {
|
|
772
|
-
accumulated[accumulator] = decoded;
|
|
773
|
-
if (accumulator == 3) {
|
|
774
|
-
outputBytes[outputLength++] = (accumulated[0] << 2) | (accumulated[1] >> 4);
|
|
775
|
-
outputBytes[outputLength++] = (accumulated[1] << 4) | (accumulated[2] >> 2);
|
|
776
|
-
outputBytes[outputLength++] = (accumulated[2] << 6) | accumulated[3];
|
|
777
|
-
}
|
|
778
|
-
accumulator = (accumulator + 1) % 4;
|
|
779
|
-
}
|
|
780
|
-
}
|
|
781
|
-
|
|
782
|
-
//handle left-over data
|
|
783
|
-
if (accumulator > 0) outputBytes[outputLength] = (accumulated[0] << 2) | (accumulated[1] >> 4);
|
|
784
|
-
if (accumulator > 1) outputBytes[++outputLength] = (accumulated[1] << 4) | (accumulated[2] >> 2);
|
|
785
|
-
if (accumulator > 2) outputLength++;
|
|
786
|
-
|
|
787
|
-
//truncate data to match actual output length
|
|
788
|
-
outputData.length = (NSUInteger)outputLength;
|
|
789
|
-
return outputLength? outputData: nil;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
791
|
+ (UIImage *)embeddedImageNamed:(NSString *)name {
|
|
793
792
|
CGFloat screenScale = [UIScreen mainScreen].scale;
|
|
794
793
|
if (screenScale > 1.0) {
|
|
@@ -809,7 +808,8 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
809
808
|
NSString *base64String = [(id)self performSelector:selector];
|
|
810
809
|
#pragma clang diagnostic pop
|
|
811
810
|
|
|
812
|
-
|
|
811
|
+
NSData *imageData = [[NSData alloc] initWithBase64EncodedString:base64String options:0];
|
|
812
|
+
UIImage *rawImage = [UIImage imageWithData:imageData];
|
|
813
813
|
return [UIImage imageWithCGImage:rawImage.CGImage scale:screenScale orientation:UIImageOrientationUp];
|
|
814
814
|
}
|
|
815
815
|
|
|
@@ -844,15 +844,15 @@ static UIImage *blackArrowImage = nil, *whiteArrowImage = nil, *grayArrowImage =
|
|
|
844
844
|
- (void)setFrameHeight:(CGFloat)height { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=height }; }
|
|
845
845
|
|
|
846
846
|
- (CGFloat)frameLeft { return self.frame.origin.x; }
|
|
847
|
-
- (void)setFrameLeft:(CGFloat)left { self.frame = (CGRect){ .origin.x=left, .origin.y=self.frame.origin.y, .size.width=
|
|
847
|
+
- (void)setFrameLeft:(CGFloat)left { self.frame = (CGRect){ .origin.x=left, .origin.y=self.frame.origin.y, .size.width=fmax(self.frame.origin.x+self.frame.size.width-left,0), .size.height=self.frame.size.height }; }
|
|
848
848
|
|
|
849
849
|
- (CGFloat)frameTop { return self.frame.origin.y; }
|
|
850
|
-
- (void)setFrameTop:(CGFloat)top { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=top, .size.width=self.frame.size.width, .size.height=
|
|
850
|
+
- (void)setFrameTop:(CGFloat)top { self.frame = (CGRect){ .origin.x=self.frame.origin.x, .origin.y=top, .size.width=self.frame.size.width, .size.height=fmax(self.frame.origin.y+self.frame.size.height-top,0) }; }
|
|
851
851
|
|
|
852
852
|
- (CGFloat)frameRight { return self.frame.origin.x + self.frame.size.width; }
|
|
853
|
-
- (void)setFrameRight:(CGFloat)right { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=
|
|
853
|
+
- (void)setFrameRight:(CGFloat)right { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=fmax(right-self.frame.origin.x,0), .size.height=self.frame.size.height }; }
|
|
854
854
|
|
|
855
855
|
- (CGFloat)frameBottom { return self.frame.origin.y + self.frame.size.height; }
|
|
856
|
-
- (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=
|
|
856
|
+
- (void)setFrameBottom:(CGFloat)bottom { self.frame = (CGRect){ .origin=self.frame.origin, .size.width=self.frame.size.width, .size.height=fmax(bottom-self.frame.origin.y,0) }; }
|
|
857
857
|
|
|
858
|
-
@end
|
|
858
|
+
@end
|
package/package.json
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"author": "Leland Richardson <leland.m.richardson@gmail.com>",
|
|
7
7
|
"homepage": "https://github.com/react-native-maps/react-native-maps#readme",
|
|
8
|
-
"version": "
|
|
8
|
+
"version": "2.0.0-beta.1",
|
|
9
9
|
"license": "MIT",
|
|
10
10
|
"scripts": {
|
|
11
11
|
"lint": "eslint . --max-warnings 0",
|