File tree 5 files changed +21
-0
lines changed
5 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -387,6 +387,7 @@ declare module "react-native-maps" {
387
387
urlTemplate : string ;
388
388
maximumZ ?: number ;
389
389
zIndex ?: number ;
390
+ tileSize ?: number ;
390
391
}
391
392
392
393
export class UrlTile extends React . Component < MapUrlTileProps , any > {
Original file line number Diff line number Diff line change @@ -49,6 +49,13 @@ const propTypes = {
49
49
* @platform ios
50
50
*/
51
51
shouldReplaceMapContent : PropTypes . bool ,
52
+
53
+ /**
54
+ * (Optional) Tile size for iOS only, default size is 256 * 256.
55
+ *
56
+ * @platform ios
57
+ */
58
+ tileSize : PropTypes . number ,
52
59
} ;
53
60
54
61
class MapUrlTile extends React . Component {
Original file line number Diff line number Diff line change 26
26
@property NSInteger maximumZ;
27
27
@property NSInteger minimumZ;
28
28
@property BOOL shouldReplaceMapContent;
29
+ @property CGFloat tileSize;
29
30
30
31
#pragma mark MKOverlay protocol
31
32
Original file line number Diff line number Diff line change 11
11
12
12
@implementation AIRMapUrlTile {
13
13
BOOL _urlTemplateSet;
14
+ BOOL _tileSizeSet;
14
15
}
15
16
16
17
- (void )setShouldReplaceMapContent : (BOOL )shouldReplaceMapContent
@@ -47,6 +48,13 @@ - (void)setUrlTemplate:(NSString *)urlTemplate{
47
48
[self update ];
48
49
}
49
50
51
+ - (void )setTileSize : (CGFloat )tileSize {
52
+ _tileSize = tileSize;
53
+ _tileSizeSet = YES ;
54
+ [self createTileOverlayAndRendererIfPossible ];
55
+ [self update ];
56
+ }
57
+
50
58
- (void ) createTileOverlayAndRendererIfPossible
51
59
{
52
60
if (!_urlTemplateSet) return ;
@@ -60,6 +68,9 @@ - (void) createTileOverlayAndRendererIfPossible
60
68
if (self.maximumZ ) {
61
69
self.tileOverlay .maximumZ = self.maximumZ ;
62
70
}
71
+ if (_tileSizeSet) {
72
+ self.tileOverlay .tileSize = CGSizeMake (self.tileSize , self.tileSize );
73
+ }
63
74
self.renderer = [[MKTileOverlayRenderer alloc ] initWithTileOverlay: self .tileOverlay];
64
75
}
65
76
Original file line number Diff line number Diff line change @@ -36,5 +36,6 @@ - (UIView *)view
36
36
RCT_EXPORT_VIEW_PROPERTY(maximumZ, NSInteger )
37
37
RCT_EXPORT_VIEW_PROPERTY(minimumZ, NSInteger )
38
38
RCT_EXPORT_VIEW_PROPERTY(shouldReplaceMapContent, BOOL )
39
+ RCT_EXPORT_VIEW_PROPERTY(tileSize, CGFloat )
39
40
40
41
@end
You can’t perform that action at this time.
0 commit comments