@maplibre/maplibre-react-native 10.1.0 → 10.1.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.
Files changed (152) hide show
  1. package/ios/MLRN/CameraStop.h +1 -1
  2. package/ios/MLRN/CameraStop.m +58 -60
  3. package/ios/MLRN/CameraUpdateItem.h +2 -1
  4. package/ios/MLRN/CameraUpdateItem.m +132 -132
  5. package/ios/MLRN/CameraUpdateQueue.m +43 -47
  6. package/ios/MLRN/FilterParser.h +1 -1
  7. package/ios/MLRN/FilterParser.m +5 -6
  8. package/ios/MLRN/MLRNBackgroundLayer.m +10 -9
  9. package/ios/MLRN/MLRNBackgroundLayerManager.m +4 -5
  10. package/ios/MLRN/MLRNCallout.h +1 -1
  11. package/ios/MLRN/MLRNCallout.m +37 -36
  12. package/ios/MLRN/MLRNCalloutManager.m +2 -3
  13. package/ios/MLRN/MLRNCamera.h +1 -1
  14. package/ios/MLRN/MLRNCamera.m +169 -182
  15. package/ios/MLRN/MLRNCameraManager.m +4 -6
  16. package/ios/MLRN/MLRNCircleLayer.m +17 -14
  17. package/ios/MLRN/MLRNCircleLayerManager.m +4 -5
  18. package/ios/MLRN/MLRNCustomHeaders.h +2 -2
  19. package/ios/MLRN/MLRNCustomHeaders.m +63 -63
  20. package/ios/MLRN/MLRNEvent.h +3 -3
  21. package/ios/MLRN/MLRNEvent.m +19 -24
  22. package/ios/MLRN/MLRNEventProtocol.h +1 -1
  23. package/ios/MLRN/MLRNFillExtrusionLayer.m +18 -14
  24. package/ios/MLRN/MLRNFillExtrusionLayerManager.m +4 -5
  25. package/ios/MLRN/MLRNFillLayer.m +16 -14
  26. package/ios/MLRN/MLRNFillLayerManager.m +4 -5
  27. package/ios/MLRN/MLRNHeatmapLayer.m +17 -14
  28. package/ios/MLRN/MLRNHeatmapLayerManager.m +4 -5
  29. package/ios/MLRN/MLRNImageQueue.h +4 -1
  30. package/ios/MLRN/MLRNImageQueue.m +29 -32
  31. package/ios/MLRN/MLRNImageQueueOperation.h +1 -1
  32. package/ios/MLRN/MLRNImageQueueOperation.m +92 -91
  33. package/ios/MLRN/MLRNImageSource.m +36 -38
  34. package/ios/MLRN/MLRNImageSourceManager.m +2 -3
  35. package/ios/MLRN/MLRNImageUtils.h +3 -3
  36. package/ios/MLRN/MLRNImageUtils.m +15 -14
  37. package/ios/MLRN/MLRNImages.h +0 -1
  38. package/ios/MLRN/MLRNImages.m +89 -91
  39. package/ios/MLRN/MLRNImagesManager.m +4 -5
  40. package/ios/MLRN/MLRNLayer.h +9 -11
  41. package/ios/MLRN/MLRNLayer.m +170 -182
  42. package/ios/MLRN/MLRNLight.m +21 -23
  43. package/ios/MLRN/MLRNLightManager.m +2 -3
  44. package/ios/MLRN/MLRNLineLayer.m +17 -15
  45. package/ios/MLRN/MLRNLineLayerManager.m +4 -6
  46. package/ios/MLRN/MLRNLocation.h +1 -1
  47. package/ios/MLRN/MLRNLocation.m +16 -17
  48. package/ios/MLRN/MLRNLocationManager.m +109 -124
  49. package/ios/MLRN/MLRNLocationManagerDelegate.h +3 -3
  50. package/ios/MLRN/MLRNLocationModule.h +1 -1
  51. package/ios/MLRN/MLRNLocationModule.m +40 -55
  52. package/ios/MLRN/MLRNLogging.h +1 -4
  53. package/ios/MLRN/MLRNLogging.m +84 -89
  54. package/ios/MLRN/MLRNMapTouchEvent.h +2 -2
  55. package/ios/MLRN/MLRNMapTouchEvent.m +50 -49
  56. package/ios/MLRN/MLRNMapView.h +43 -36
  57. package/ios/MLRN/MLRNMapView.m +409 -440
  58. package/ios/MLRN/MLRNMapViewManager.m +489 -502
  59. package/ios/MLRN/MLRNModule.h +1 -1
  60. package/ios/MLRN/MLRNModule.m +111 -105
  61. package/ios/MLRN/MLRNNativeUserLocation.m +24 -27
  62. package/ios/MLRN/MLRNNativeUserLocationManager.m +4 -8
  63. package/ios/MLRN/MLRNOfflineModule.h +1 -1
  64. package/ios/MLRN/MLRNOfflineModule.m +416 -421
  65. package/ios/MLRN/MLRNPointAnnotation.h +2 -2
  66. package/ios/MLRN/MLRNPointAnnotation.m +154 -175
  67. package/ios/MLRN/MLRNPointAnnotationManager.m +2 -3
  68. package/ios/MLRN/MLRNRasterLayer.m +16 -12
  69. package/ios/MLRN/MLRNRasterLayerManager.m +4 -5
  70. package/ios/MLRN/MLRNRasterSource.m +21 -17
  71. package/ios/MLRN/MLRNRasterSourceManager.m +2 -3
  72. package/ios/MLRN/MLRNShapeSource.h +17 -16
  73. package/ios/MLRN/MLRNShapeSource.m +94 -102
  74. package/ios/MLRN/MLRNShapeSourceManager.h +2 -2
  75. package/ios/MLRN/MLRNShapeSourceManager.m +86 -90
  76. package/ios/MLRN/MLRNSnapshotModule.h +1 -1
  77. package/ios/MLRN/MLRNSnapshotModule.m +51 -53
  78. package/ios/MLRN/MLRNSource.h +12 -12
  79. package/ios/MLRN/MLRNSource.m +82 -88
  80. package/ios/MLRN/MLRNStyleValue.h +1 -1
  81. package/ios/MLRN/MLRNStyleValue.m +128 -128
  82. package/ios/MLRN/MLRNSymbolLayer.m +17 -13
  83. package/ios/MLRN/MLRNSymbolLayerManager.m +4 -5
  84. package/ios/MLRN/MLRNTileSource.h +1 -1
  85. package/ios/MLRN/MLRNTileSource.m +21 -20
  86. package/ios/MLRN/MLRNUserLocation.h +1 -1
  87. package/ios/MLRN/MLRNUserLocation.m +10 -12
  88. package/ios/MLRN/MLRNUtils.h +18 -11
  89. package/ios/MLRN/MLRNUtils.m +168 -160
  90. package/ios/MLRN/MLRNVectorLayer.m +28 -34
  91. package/ios/MLRN/MLRNVectorSource.h +3 -1
  92. package/ios/MLRN/MLRNVectorSource.m +14 -11
  93. package/ios/MLRN/MLRNVectorSourceManager.h +2 -2
  94. package/ios/MLRN/MLRNVectorSourceManager.m +36 -39
  95. package/ios/MLRN/ViewManager.h +1 -1
  96. package/ios/MLRN/ViewManager.m +29 -35
  97. package/lib/commonjs/components/MarkerView.js +1 -1
  98. package/lib/commonjs/components/UserLocation.js +8 -38
  99. package/lib/commonjs/components/UserLocation.js.map +1 -1
  100. package/lib/commonjs/components/UserLocationPuck.js +52 -0
  101. package/lib/commonjs/components/UserLocationPuck.js.map +1 -0
  102. package/lib/commonjs/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +12 -9
  103. package/lib/commonjs/components/UserLocationPuckHeading.js.map +1 -0
  104. package/lib/module/components/MarkerView.js +1 -1
  105. package/lib/module/components/UserLocation.js +7 -36
  106. package/lib/module/components/UserLocation.js.map +1 -1
  107. package/lib/module/components/UserLocationPuck.js +48 -0
  108. package/lib/module/components/UserLocationPuck.js.map +1 -0
  109. package/lib/module/components/{HeadingIndicator.js → UserLocationPuckHeading.js} +11 -7
  110. package/lib/module/components/UserLocationPuckHeading.js.map +1 -0
  111. package/lib/typescript/commonjs/src/components/MarkerView.d.ts +1 -1
  112. package/lib/typescript/commonjs/src/components/UserLocation.d.ts +0 -1
  113. package/lib/typescript/commonjs/src/components/UserLocation.d.ts.map +1 -1
  114. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts +9 -0
  115. package/lib/typescript/commonjs/src/components/UserLocationPuck.d.ts.map +1 -0
  116. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts +9 -0
  117. package/lib/typescript/commonjs/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  118. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
  119. package/lib/typescript/commonjs/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  120. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
  121. package/lib/typescript/commonjs/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  122. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts +0 -1
  123. package/lib/typescript/commonjs/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  124. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts +0 -1
  125. package/lib/typescript/commonjs/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  126. package/lib/typescript/module/src/components/MarkerView.d.ts +1 -1
  127. package/lib/typescript/module/src/components/UserLocation.d.ts +0 -1
  128. package/lib/typescript/module/src/components/UserLocation.d.ts.map +1 -1
  129. package/lib/typescript/module/src/components/UserLocationPuck.d.ts +9 -0
  130. package/lib/typescript/module/src/components/UserLocationPuck.d.ts.map +1 -0
  131. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts +9 -0
  132. package/lib/typescript/module/src/components/UserLocationPuckHeading.d.ts.map +1 -0
  133. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts +0 -1
  134. package/lib/typescript/module/src/utils/animated/AbstractAnimatedCoordinates.d.ts.map +1 -1
  135. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts +0 -1
  136. package/lib/typescript/module/src/utils/animated/AnimatedExtractCoordinateFromArray.d.ts.map +1 -1
  137. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts +0 -1
  138. package/lib/typescript/module/src/utils/animated/AnimatedPoint.d.ts.map +1 -1
  139. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts +0 -1
  140. package/lib/typescript/module/src/utils/animated/AnimatedShape.d.ts.map +1 -1
  141. package/package.json +8 -8
  142. package/src/components/MarkerView.tsx +1 -1
  143. package/src/components/UserLocation.tsx +13 -51
  144. package/src/components/UserLocationPuck.tsx +62 -0
  145. package/src/components/UserLocationPuckHeading.tsx +33 -0
  146. package/lib/commonjs/components/HeadingIndicator.js.map +0 -1
  147. package/lib/module/components/HeadingIndicator.js.map +0 -1
  148. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts +0 -7
  149. package/lib/typescript/commonjs/src/components/HeadingIndicator.d.ts.map +0 -1
  150. package/lib/typescript/module/src/components/HeadingIndicator.d.ts +0 -7
  151. package/lib/typescript/module/src/components/HeadingIndicator.d.ts.map +0 -1
  152. package/src/components/HeadingIndicator.tsx +0 -26
@@ -1,6 +1,5 @@
1
- #import <UIKit/UIKit.h>
2
1
  #import <React/RCTBridge.h>
3
-
2
+ #import <UIKit/UIKit.h>
4
3
 
5
4
  @class MLRNMapView;
6
5
 
@@ -8,11 +7,11 @@
8
7
 
9
8
  @interface MLRNLayer<T> : UIView
10
9
 
11
- @property (nonatomic, weak, nullable) RCTBridge* bridge;
10
+ @property (nonatomic, weak, nullable) RCTBridge *bridge;
12
11
 
13
12
  @property (nonatomic, strong, nullable) MLNStyleLayer *styleLayer;
14
13
  @property (nonatomic, strong, nullable) MLNStyle *style;
15
- @property (nonatomic, weak, nullable) MLRNMapView* map;
14
+ @property (nonatomic, weak, nullable) MLRNMapView *map;
16
15
  @property (nonatomic, strong, nullable) NSDictionary *reactStyle;
17
16
  @property (nonatomic, strong, nullable) NSArray *filter;
18
17
 
@@ -26,19 +25,18 @@
26
25
  @property (nonatomic, copy, nullable) NSNumber *maxZoomLevel;
27
26
  @property (nonatomic, copy, nullable) NSNumber *minZoomLevel;
28
27
 
29
- - (void)addToMap:(nonnull MLRNMapView*)map style:(nonnull MLNStyle*)style;
28
+ - (void)addToMap:(nonnull MLRNMapView *)map style:(nonnull MLNStyle *)style;
30
29
  - (void)addedToMap;
31
- - (void)removeFromMap:(nonnull MLNStyle*)style;
32
- - (nullable T)makeLayer:(nonnull MLNStyle*)style;
30
+ - (void)removeFromMap:(nonnull MLNStyle *)style;
31
+ - (nullable T)makeLayer:(nonnull MLNStyle *)style;
33
32
  - (void)addStyles;
34
- - (void)insertAbove:(nonnull NSString*)layer;
35
- - (void)insertBelow:(nonnull NSString*)layer;
33
+ - (void)insertAbove:(nonnull NSString *)layer;
34
+ - (void)insertBelow:(nonnull NSString *)layer;
36
35
  - (void)insertAtIndex:(NSUInteger)index;
37
- - (void)insertLayer;
38
36
  - (void)setZoomBounds;
39
37
 
40
38
  - (BOOL)isAddedToMap;
41
39
 
42
- - (nullable MLNSource*)layerWithSourceIDInStyle:(nonnull MLNStyle*) style;
40
+ - (nullable MLNSource *)layerWithSourceIDInStyle:(nonnull MLNStyle *)style;
43
41
 
44
42
  @end
@@ -1,228 +1,216 @@
1
1
  #import "MLRNLayer.h"
2
+ #import "MLRNMapView.h"
2
3
  #import "MLRNSource.h"
3
4
  #import "MLRNStyleValue.h"
4
5
  #import "MLRNUtils.h"
5
- #import "MLRNMapView.h"
6
6
 
7
7
  @implementation MLRNLayer
8
8
 
9
- - (void)setMinZoomLevel:(NSNumber*)minZoomLevel
10
- {
11
- _minZoomLevel = minZoomLevel;
12
-
13
- if (_styleLayer != nil) {
14
- _styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
15
- }
16
- }
9
+ - (void)setMinZoomLevel:(NSNumber *)minZoomLevel {
10
+ _minZoomLevel = minZoomLevel;
17
11
 
18
- - (void)setMaxZoomLevel:(NSNumber*)maxZoomLevel
19
- {
20
- _maxZoomLevel = maxZoomLevel;
21
-
22
- if (_styleLayer != nil) {
23
- _styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
24
- }
12
+ if (_styleLayer != nil) {
13
+ _styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
14
+ }
25
15
  }
26
16
 
27
- - (void)setAboveLayerID:(NSString *)aboveLayerID
28
- {
29
- if (_aboveLayerID != nil && _aboveLayerID == aboveLayerID) {
30
- return;
31
- }
32
-
33
- _aboveLayerID = aboveLayerID;
34
- if (_styleLayer != nil) {
35
- [self removeFromMap:_style];
36
- [self insertAbove:aboveLayerID];
37
- }
38
- }
17
+ - (void)setMaxZoomLevel:(NSNumber *)maxZoomLevel {
18
+ _maxZoomLevel = maxZoomLevel;
39
19
 
40
- - (void)setBelowLayerID:(NSString *)belowLayerID
41
- {
42
- if (_belowLayerID != nil && _belowLayerID == belowLayerID) {
43
- return;
44
- }
45
-
46
- _belowLayerID = belowLayerID;
47
- if (_styleLayer != nil) {
48
- [self removeFromMap:_style];
49
- [self insertBelow:_belowLayerID];
50
- }
20
+ if (_styleLayer != nil) {
21
+ _styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
22
+ }
51
23
  }
52
24
 
53
- - (void)setLayerIndex:(NSNumber *)layerIndex
54
- {
55
- if (_layerIndex != nil && _layerIndex == layerIndex) {
56
- return;
57
- }
58
-
59
- _layerIndex = layerIndex;
60
- if (_styleLayer != nil) {
61
- [self removeFromMap:_style];
62
- [self insertAtIndex:_layerIndex.unsignedIntegerValue];
63
- }
25
+ - (void)setAboveLayerID:(NSString *)aboveLayerID {
26
+ if (_aboveLayerID != nil && _aboveLayerID == aboveLayerID) {
27
+ return;
28
+ }
29
+
30
+ _aboveLayerID = aboveLayerID;
31
+ if (_styleLayer != nil) {
32
+ [self removeFromMap:_style];
33
+ [self insertAbove:aboveLayerID];
34
+ }
64
35
  }
65
36
 
66
- - (void)setMap:(MLRNMapView *)map {
67
- if (map == nil) {
68
- [self removeFromMap:_map.style];
69
- _map = nil;
70
- } else {
71
- _map = map;
72
- [self addToMap:map style:map.style];
73
- }
37
+ - (void)setBelowLayerID:(NSString *)belowLayerID {
38
+ if (_belowLayerID != nil && _belowLayerID == belowLayerID) {
39
+ return;
40
+ }
41
+
42
+ _belowLayerID = belowLayerID;
43
+ if (_styleLayer != nil) {
44
+ [self removeFromMap:_style];
45
+ [self insertBelow:_belowLayerID];
46
+ }
74
47
  }
75
48
 
76
- -(void)setReactStyle:(NSDictionary *)reactStyle
77
- {
78
- _reactStyle = reactStyle;
79
-
80
- if (_styleLayer != nil) {
81
- dispatch_async(dispatch_get_main_queue(), ^{
82
- [self addStyles];
83
- });
84
- }
49
+ - (void)setLayerIndex:(NSNumber *)layerIndex {
50
+ if (_layerIndex != nil && _layerIndex == layerIndex) {
51
+ return;
52
+ }
53
+
54
+ _layerIndex = layerIndex;
55
+ if (_styleLayer != nil) {
56
+ [self removeFromMap:_style];
57
+ [self insertAtIndex:_layerIndex.unsignedIntegerValue];
58
+ }
85
59
  }
86
60
 
87
- - (void)addToMap:(MLRNMapView*) map style:(MLNStyle *)style
88
- {
89
- if (style == nil) {
90
- return;
91
- }
61
+ - (void)setMap:(MLRNMapView *)map {
62
+ if (map == nil) {
63
+ [self removeFromMap:_map.style];
64
+ _map = nil;
65
+ } else {
92
66
  _map = map;
93
- _style = style;
94
- if (_id == nil) {
95
- RCTLogError(@"Cannot add a layer without id to the map: %@", self);
67
+ [self addToMap:map style:map.style];
68
+ }
69
+ }
70
+
71
+ - (void)setReactStyle:(NSDictionary *)reactStyle {
72
+ _reactStyle = reactStyle;
73
+
74
+ if (_styleLayer != nil) {
75
+ dispatch_async(dispatch_get_main_queue(), ^{
76
+ [self addStyles];
77
+ });
78
+ }
79
+ }
80
+
81
+ - (void)addToMap:(MLRNMapView *)map style:(MLNStyle *)style {
82
+ if (style == nil) {
83
+ return;
84
+ }
85
+ _map = map;
86
+ _style = style;
87
+ if (_id == nil) {
88
+ RCTLogError(@"Cannot add a layer without id to the map: %@", self);
89
+ return;
90
+ }
91
+ MLNStyleLayer *existingLayer = [style layerWithIdentifier:_id];
92
+ if (existingLayer != nil) {
93
+ _styleLayer = existingLayer;
94
+ } else {
95
+ _styleLayer = [self makeLayer:style];
96
+ if (_styleLayer == nil) {
97
+ RCTLogError(@"Failed to make layer: %@", _id);
96
98
  return;
97
99
  }
98
- MLNStyleLayer *existingLayer = [style layerWithIdentifier:_id];
99
- if (existingLayer != nil) {
100
- _styleLayer = existingLayer;
101
- } else {
102
- _styleLayer = [self makeLayer:style];
103
- if (_styleLayer == nil) {
104
- RCTLogError(@"Failed to make layer: %@", _id);
105
- return;
106
- }
107
- [self insertLayer: map];
108
- }
109
-
110
- [self addStyles];
111
- [self addedToMap];
100
+ [self insertLayer:map];
101
+ }
102
+
103
+ [self addStyles];
104
+ [self addedToMap];
112
105
  }
113
106
 
114
- - (nullable MLNSource*)layerWithSourceIDInStyle:(nonnull MLNStyle*) style
115
- {
116
- MLNSource* result = [style sourceWithIdentifier: self.sourceID];
117
- if (result == NULL) {
118
- RCTLogError(@"Cannot find layer with id: %@ referenced by layer:%@", self.sourceID, _id);
119
- }
120
- return result;
107
+ - (nullable MLNSource *)layerWithSourceIDInStyle:(nonnull MLNStyle *)style {
108
+ MLNSource *result = [style sourceWithIdentifier:self.sourceID];
109
+ if (result == NULL) {
110
+ RCTLogError(@"Cannot find layer with id: %@ referenced by layer:%@", self.sourceID, _id);
111
+ }
112
+ return result;
121
113
  }
122
114
 
123
- - (void)removeFromMap:(MLNStyle *)style
124
- {
125
- if (_styleLayer != nil) {
126
- [style removeLayer:_styleLayer];
127
- }
128
- _style = nil;
115
+ - (void)removeFromMap:(MLNStyle *)style {
116
+ if (_styleLayer != nil) {
117
+ [style removeLayer:_styleLayer];
118
+ }
119
+ _style = nil;
129
120
  }
130
121
 
131
- - (BOOL)isAddedToMap
132
- {
133
- return (_style != nil);
122
+ - (BOOL)isAddedToMap {
123
+ return (_style != nil);
134
124
  }
135
125
 
136
- - (nullable MLNStyleLayer*)makeLayer:(MLNStyle*)style
137
- {
138
- @throw [NSException exceptionWithName:NSInternalInconsistencyException
139
- reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]
140
- userInfo:nil];
126
+ - (nullable MLNStyleLayer *)makeLayer:(MLNStyle *)style {
127
+ @throw [NSException
128
+ exceptionWithName:NSInternalInconsistencyException
129
+ reason:[NSString stringWithFormat:@"You must override %@ in a subclass",
130
+ NSStringFromSelector(_cmd)]
131
+ userInfo:nil];
141
132
  }
142
133
 
143
- - (void)addStyles
144
- {
145
- @throw [NSException exceptionWithName:NSInternalInconsistencyException
146
- reason:[NSString stringWithFormat:@"You must override %@ in a subclass", NSStringFromSelector(_cmd)]
147
- userInfo:nil];
134
+ - (void)addStyles {
135
+ @throw [NSException
136
+ exceptionWithName:NSInternalInconsistencyException
137
+ reason:[NSString stringWithFormat:@"You must override %@ in a subclass",
138
+ NSStringFromSelector(_cmd)]
139
+ userInfo:nil];
148
140
  }
149
141
 
150
- - (void)addedToMap
151
- {
152
- // override if you want
142
+ - (void)addedToMap {
143
+ // override if you want
153
144
  }
154
145
 
155
- - (void)insertLayer: (MLRNMapView*) map
156
- {
157
- if ([_style layerWithIdentifier:_id] != nil) {
158
- return; // prevent layer from being added twice
159
- }
146
+ - (void)insertLayer:(MLRNMapView *)map {
147
+ if ([_style layerWithIdentifier:_id] != nil) {
148
+ return; // prevent layer from being added twice
149
+ }
160
150
 
161
- if (_aboveLayerID != nil) {
162
- [self insertAbove:_aboveLayerID];
163
- } else if (_belowLayerID != nil) {
164
- [self insertBelow:_belowLayerID];
165
- } else if (_layerIndex != nil) {
166
- [self insertAtIndex:_layerIndex.unsignedIntegerValue];
167
- } else {
168
- [_style addLayer:_styleLayer];
169
- [_map layerAdded:_styleLayer];
170
- }
171
-
172
- [self setZoomBounds];
151
+ if (_aboveLayerID != nil) {
152
+ [self insertAbove:_aboveLayerID];
153
+ } else if (_belowLayerID != nil) {
154
+ [self insertBelow:_belowLayerID];
155
+ } else if (_layerIndex != nil) {
156
+ [self insertAtIndex:_layerIndex.unsignedIntegerValue];
157
+ } else {
158
+ [_style addLayer:_styleLayer];
159
+ [_map layerAdded:_styleLayer];
160
+ }
161
+
162
+ [self setZoomBounds];
173
163
  }
174
164
 
175
- - (void)setZoomBounds
176
- {
177
- if (_maxZoomLevel != nil) {
178
- _styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
179
- }
180
-
181
- if (_minZoomLevel != nil) {
182
- _styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
183
- }
165
+ - (void)setZoomBounds {
166
+ if (_maxZoomLevel != nil) {
167
+ _styleLayer.maximumZoomLevel = [_maxZoomLevel doubleValue];
168
+ }
169
+
170
+ if (_minZoomLevel != nil) {
171
+ _styleLayer.minimumZoomLevel = [_minZoomLevel doubleValue];
172
+ }
184
173
  }
185
174
 
186
- -(void)insertAbove:(NSString*)aboveLayerIDs
187
- {
188
- [_map waitForLayerWithID: aboveLayerIDs then:^void (MLNStyleLayer* layer) {
189
- if (![self _hasInitialized]) {
190
- return;
191
- }
192
- [self->_style insertLayer:self->_styleLayer aboveLayer:layer];
193
- [self->_map layerAdded:self->_styleLayer];
194
- }];
195
- }
196
-
197
- -(void)insertBelow:(NSString*)belowLayerID
198
- {
199
- [_map waitForLayerWithID: belowLayerID then:^void (MLNStyleLayer* layer) {
200
- if (![self _hasInitialized]) {
201
- return;
202
- }
203
-
204
- [self->_style insertLayer:self->_styleLayer belowLayer:layer];
205
- [self->_map layerAdded:self->_styleLayer];
206
- }];
207
- }
208
-
209
- -(void)insertAtIndex:(NSUInteger)index
210
- {
211
- if (![self _hasInitialized]) {
212
- return;
213
- }
214
- NSArray *layers = _style.layers;
215
- if (index >= layers.count) {
216
- RCTLogWarn(@"Layer index is greater than number of layers on map. Layer inserted at end of layer stack.");
217
- index = layers.count - 1;
218
- }
219
- [_style insertLayer:self->_styleLayer atIndex:index];
220
- [_map layerAdded:self->_styleLayer];
175
+ - (void)insertAbove:(NSString *)aboveLayerIDs {
176
+ [_map waitForLayerWithID:aboveLayerIDs
177
+ then:^void(MLNStyleLayer *layer) {
178
+ if (![self _hasInitialized]) {
179
+ return;
180
+ }
181
+ [self->_style insertLayer:self->_styleLayer aboveLayer:layer];
182
+ [self->_map layerAdded:self->_styleLayer];
183
+ }];
184
+ }
185
+
186
+ - (void)insertBelow:(NSString *)belowLayerID {
187
+ [_map waitForLayerWithID:belowLayerID
188
+ then:^void(MLNStyleLayer *layer) {
189
+ if (![self _hasInitialized]) {
190
+ return;
191
+ }
192
+
193
+ [self->_style insertLayer:self->_styleLayer belowLayer:layer];
194
+ [self->_map layerAdded:self->_styleLayer];
195
+ }];
196
+ }
197
+
198
+ - (void)insertAtIndex:(NSUInteger)index {
199
+ if (![self _hasInitialized]) {
200
+ return;
201
+ }
202
+ NSArray *layers = _style.layers;
203
+ if (index >= layers.count) {
204
+ RCTLogWarn(@"Layer index is greater than number of layers on map. Layer inserted at end of "
205
+ @"layer stack.");
206
+ index = layers.count - 1;
207
+ }
208
+ [_style insertLayer:self->_styleLayer atIndex:index];
209
+ [_map layerAdded:self->_styleLayer];
221
210
  }
222
211
 
223
- - (BOOL)_hasInitialized
224
- {
225
- return _style != nil && _styleLayer != nil;
212
+ - (BOOL)_hasInitialized {
213
+ return _style != nil && _styleLayer != nil;
226
214
  }
227
215
 
228
216
  @end
@@ -1,38 +1,36 @@
1
1
  #import "MLRNLight.h"
2
2
  #import "MLRNStyle.h"
3
3
 
4
- @implementation MLRNLight
5
- {
6
- MLNLight *internalLight;
4
+ @implementation MLRNLight {
5
+ MLNLight *internalLight;
7
6
  }
8
7
 
9
- - (void)setReactStyle:(NSDictionary *)reactStyle
10
- {
11
- _reactStyle = reactStyle;
12
-
13
- if (_map != nil) {
14
- [self addStyles];
15
- }
16
- }
8
+ - (void)setReactStyle:(NSDictionary *)reactStyle {
9
+ _reactStyle = reactStyle;
17
10
 
18
- - (void)setMap:(MLNMapView *)map
19
- {
20
- _map = map;
11
+ if (_map != nil) {
21
12
  [self addStyles];
13
+ }
14
+ }
15
+
16
+ - (void)setMap:(MLNMapView *)map {
17
+ _map = map;
18
+ [self addStyles];
22
19
  }
23
20
 
24
21
  - (BOOL)isAddedToMap {
25
- return _map != NULL;
22
+ return _map != NULL;
26
23
  }
27
24
 
28
- - (void)addStyles
29
- {
30
- MLNLight *light = [[MLNLight alloc] init];
31
- MLRNStyle *style = [[MLRNStyle alloc] init];
32
- [style lightLayer:light withReactStyle:_reactStyle isValid:^{
33
- return [self isAddedToMap];
34
- }];
35
- _map.style.light = light;
25
+ - (void)addStyles {
26
+ MLNLight *light = [[MLNLight alloc] init];
27
+ MLRNStyle *style = [[MLRNStyle alloc] init];
28
+ [style lightLayer:light
29
+ withReactStyle:_reactStyle
30
+ isValid:^{
31
+ return [self isAddedToMap];
32
+ }];
33
+ _map.style.light = light;
36
34
  }
37
35
 
38
36
  @end
@@ -7,9 +7,8 @@ RCT_EXPORT_MODULE()
7
7
 
8
8
  RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
9
9
 
10
- - (UIView*)view
11
- {
12
- return [MLRNLight new];
10
+ - (UIView*)view {
11
+ return [MLRNLight new];
13
12
  }
14
13
 
15
14
  @end
@@ -1,25 +1,27 @@
1
1
  #import "MLRNLineLayer.h"
2
- #import "MLRNStyle.h"
3
2
  #import <React/RCTLog.h>
3
+ #import "MLRNStyle.h"
4
4
 
5
5
  @implementation MLRNLineLayer
6
6
 
7
- - (MLNLineStyleLayer*)makeLayer:(MLNStyle*)style
8
- {
9
- MLNSource *source = [self layerWithSourceIDInStyle:style];
10
- if (source == nil) { return nil; }
11
- MLNLineStyleLayer *layer = [[MLNLineStyleLayer alloc] initWithIdentifier:self.id source:source];
12
- layer.sourceLayerIdentifier = self.sourceLayerID;
13
- return layer;
7
+ - (MLNLineStyleLayer *)makeLayer:(MLNStyle *)style {
8
+ MLNSource *source = [self layerWithSourceIDInStyle:style];
9
+ if (source == nil) {
10
+ return nil;
11
+ }
12
+ MLNLineStyleLayer *layer = [[MLNLineStyleLayer alloc] initWithIdentifier:self.id source:source];
13
+ layer.sourceLayerIdentifier = self.sourceLayerID;
14
+ return layer;
14
15
  }
15
16
 
16
- - (void)addStyles
17
- {
18
- MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
19
- style.bridge = self.bridge;
20
- [style lineLayer:(MLNLineStyleLayer *)self.styleLayer withReactStyle:self.reactStyle isValid:^{
21
- return [self isAddedToMap];
22
- }];
17
+ - (void)addStyles {
18
+ MLRNStyle *style = [[MLRNStyle alloc] initWithMLNStyle:self.style];
19
+ style.bridge = self.bridge;
20
+ [style lineLayer:(MLNLineStyleLayer *)self.styleLayer
21
+ withReactStyle:self.reactStyle
22
+ isValid:^{
23
+ return [self isAddedToMap];
24
+ }];
23
25
  }
24
26
 
25
27
  @end
@@ -21,12 +21,10 @@ RCT_EXPORT_VIEW_PROPERTY(reactStyle, NSDictionary);
21
21
  RCT_EXPORT_VIEW_PROPERTY(maxZoomLevel, NSNumber);
22
22
  RCT_EXPORT_VIEW_PROPERTY(minZoomLevel, NSNumber);
23
23
 
24
- - (UIView*)view
25
- {
26
- MLRNLineLayer *layer = [MLRNLineLayer new];
27
- layer.bridge = self.bridge;
28
- return layer;
24
+ - (UIView *)view {
25
+ MLRNLineLayer *layer = [MLRNLineLayer new];
26
+ layer.bridge = self.bridge;
27
+ return layer;
29
28
  }
30
29
 
31
-
32
30
  @end
@@ -1,5 +1,5 @@
1
- #import <Foundation/Foundation.h>
2
1
  #import <CoreLocation/CoreLocation.h>
2
+ #import <Foundation/Foundation.h>
3
3
 
4
4
  @interface MLRNLocation : NSObject
5
5
 
@@ -2,23 +2,22 @@
2
2
 
3
3
  @implementation MLRNLocation
4
4
 
5
- - (NSDictionary<NSString *, id> *)toJSON
6
- {
7
- NSMutableDictionary<NSString *, id> *json = [[NSMutableDictionary alloc] init];
8
-
9
- NSMutableDictionary<NSString *, NSNumber *> *coords = [[NSMutableDictionary alloc] init];
10
- coords[@"longitude"] = @(_location.coordinate.longitude);
11
- coords[@"latitude"] = @(_location.coordinate.latitude);
12
- coords[@"altitude"] = @(_location.altitude);
13
- coords[@"accuracy"] = @(_location.horizontalAccuracy);
14
- coords[@"heading"] = @(_heading.trueHeading);
15
- coords[@"course"] = @(_location.course);
16
- coords[@"speed"] = @(_location.speed);
17
-
18
- json[@"coords"] = coords;
19
- json[@"timestamp"] = @([_location.timestamp timeIntervalSince1970]);
20
-
21
- return json;
5
+ - (NSDictionary<NSString *, id> *)toJSON {
6
+ NSMutableDictionary<NSString *, id> *json = [[NSMutableDictionary alloc] init];
7
+
8
+ NSMutableDictionary<NSString *, NSNumber *> *coords = [[NSMutableDictionary alloc] init];
9
+ coords[@"longitude"] = @(_location.coordinate.longitude);
10
+ coords[@"latitude"] = @(_location.coordinate.latitude);
11
+ coords[@"altitude"] = @(_location.altitude);
12
+ coords[@"accuracy"] = @(_location.horizontalAccuracy);
13
+ coords[@"heading"] = @(_heading.trueHeading);
14
+ coords[@"course"] = @(_location.course);
15
+ coords[@"speed"] = @(_location.speed);
16
+
17
+ json[@"coords"] = coords;
18
+ json[@"timestamp"] = @([_location.timestamp timeIntervalSince1970]);
19
+
20
+ return json;
22
21
  }
23
22
 
24
23
  @end