@lugg/maps 0.2.0-alpha.0 → 0.2.0-alpha.10

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/README.md +17 -4
  2. package/android/src/main/java/com/luggmaps/{LuggMapsGoogleMapView.kt → LuggGoogleMapView.kt} +111 -36
  3. package/android/src/main/java/com/luggmaps/{LuggMapsGoogleMapViewManager.kt → LuggGoogleMapViewManager.kt} +66 -39
  4. package/android/src/main/java/com/luggmaps/{LuggMapsWrapperView.kt → LuggMapWrapperView.kt} +1 -1
  5. package/android/src/main/java/com/luggmaps/LuggMapWrapperViewManager.kt +25 -0
  6. package/android/src/main/java/com/luggmaps/{LuggMapsMarkerView.kt → LuggMarkerView.kt} +13 -7
  7. package/android/src/main/java/com/luggmaps/{LuggMapsMarkerViewManager.kt → LuggMarkerViewManager.kt} +23 -17
  8. package/android/src/main/java/com/luggmaps/{LuggMapsPackage.kt → LuggPackage.kt} +2 -2
  9. package/android/src/main/java/com/luggmaps/{LuggMapsPolylineView.kt → LuggPolylineView.kt} +11 -4
  10. package/android/src/main/java/com/luggmaps/{LuggMapsPolylineViewManager.kt → LuggPolylineViewManager.kt} +22 -16
  11. package/android/src/main/java/com/luggmaps/core/PolylineAnimator.kt +89 -43
  12. package/android/src/main/java/com/luggmaps/events/CameraIdleEvent.kt +10 -2
  13. package/android/src/main/java/com/luggmaps/events/CameraMoveEvent.kt +6 -5
  14. package/android/src/main/java/com/luggmaps/events/ReadyEvent.kt +12 -0
  15. package/android/src/main/java/com/luggmaps/extensions/ViewExtensions.kt +14 -0
  16. package/ios/{LuggMapsAppleMapView.h → LuggAppleMapView.h} +2 -2
  17. package/ios/{LuggMapsAppleMapView.mm → LuggAppleMapView.mm} +140 -71
  18. package/ios/{LuggMapsGoogleMapView.h → LuggGoogleMapView.h} +1 -1
  19. package/ios/{LuggMapsGoogleMapView.mm → LuggGoogleMapView.mm} +82 -64
  20. package/ios/{LuggMapsWrapperView.h → LuggMapWrapperView.h} +1 -1
  21. package/ios/{LuggMapsWrapperView.mm → LuggMapWrapperView.mm} +7 -7
  22. package/ios/{LuggMapsMarkerView.h → LuggMarkerView.h} +8 -6
  23. package/ios/{LuggMapsMarkerView.mm → LuggMarkerView.mm} +21 -8
  24. package/ios/{LuggMapsPolylineView.h → LuggPolylineView.h} +6 -5
  25. package/ios/{LuggMapsPolylineView.mm → LuggPolylineView.mm} +14 -9
  26. package/ios/core/GMSPolylineAnimator.m +85 -36
  27. package/ios/core/MKPolylineAnimator.m +63 -32
  28. package/ios/events/CameraIdleEvent.h +6 -1
  29. package/ios/events/CameraMoveEvent.h +6 -3
  30. package/ios/events/ReadyEvent.h +20 -0
  31. package/lib/module/MapProvider.js +13 -0
  32. package/lib/module/MapProvider.js.map +1 -0
  33. package/lib/module/MapProvider.types.js +4 -0
  34. package/lib/module/MapProvider.types.js.map +1 -0
  35. package/lib/module/MapProvider.web.js +14 -0
  36. package/lib/module/MapProvider.web.js.map +1 -0
  37. package/lib/module/MapView.js +21 -7
  38. package/lib/module/MapView.js.map +1 -1
  39. package/lib/module/MapView.web.js +266 -0
  40. package/lib/module/MapView.web.js.map +1 -0
  41. package/lib/module/{Marker.js → components/Marker.js} +6 -3
  42. package/lib/module/components/Marker.js.map +1 -0
  43. package/lib/module/components/Marker.web.js +34 -0
  44. package/lib/module/components/Marker.web.js.map +1 -0
  45. package/lib/module/{Polyline.js → components/Polyline.js} +7 -4
  46. package/lib/module/components/Polyline.js.map +1 -0
  47. package/lib/module/components/Polyline.web.js +177 -0
  48. package/lib/module/components/Polyline.web.js.map +1 -0
  49. package/lib/module/components/index.js +5 -0
  50. package/lib/module/components/index.js.map +1 -0
  51. package/lib/module/components/index.web.js +5 -0
  52. package/lib/module/components/index.web.js.map +1 -0
  53. package/{src/fabric/LuggMapsAppleMapViewNativeComponent.ts → lib/module/fabric/LuggAppleMapViewNativeComponent.ts} +13 -3
  54. package/lib/module/fabric/{LuggMapsGoogleMapViewNativeComponent.ts → LuggGoogleMapViewNativeComponent.ts} +13 -3
  55. package/{src/fabric/LuggMapsWrapperViewNativeComponent.ts → lib/module/fabric/LuggMapWrapperViewNativeComponent.ts} +1 -1
  56. package/lib/module/fabric/{LuggMapsMarkerViewNativeComponent.ts → LuggMarkerViewNativeComponent.ts} +1 -1
  57. package/{src/fabric/LuggMapsPolylineViewNativeComponent.ts → lib/module/fabric/LuggPolylineViewNativeComponent.ts} +1 -1
  58. package/lib/module/index.js +3 -3
  59. package/lib/module/index.js.map +1 -1
  60. package/lib/module/index.web.js +6 -0
  61. package/lib/module/index.web.js.map +1 -0
  62. package/lib/typescript/plugin/src/withLuggMapsAndroid.d.ts +6 -0
  63. package/lib/typescript/plugin/src/withLuggMapsAndroid.d.ts.map +1 -0
  64. package/lib/typescript/plugin/src/withLuggMapsIOS.d.ts +6 -0
  65. package/lib/typescript/plugin/src/withLuggMapsIOS.d.ts.map +1 -0
  66. package/lib/typescript/src/MapProvider.d.ts +8 -0
  67. package/lib/typescript/src/MapProvider.d.ts.map +1 -0
  68. package/lib/typescript/src/MapProvider.types.d.ts +16 -0
  69. package/lib/typescript/src/MapProvider.types.d.ts.map +1 -0
  70. package/lib/typescript/src/MapProvider.web.d.ts +3 -0
  71. package/lib/typescript/src/MapProvider.web.d.ts.map +1 -0
  72. package/lib/typescript/src/MapView.d.ts.map +1 -1
  73. package/lib/typescript/src/MapView.types.d.ts +24 -14
  74. package/lib/typescript/src/MapView.types.d.ts.map +1 -1
  75. package/lib/typescript/src/MapView.web.d.ts +12 -0
  76. package/lib/typescript/src/MapView.web.d.ts.map +1 -0
  77. package/lib/typescript/src/{Marker.types.d.ts → components/Marker.d.ts} +10 -5
  78. package/lib/typescript/src/components/Marker.d.ts.map +1 -0
  79. package/lib/typescript/src/{Marker.d.ts → components/Marker.web.d.ts} +2 -2
  80. package/lib/typescript/src/components/Marker.web.d.ts.map +1 -0
  81. package/lib/typescript/src/{Polyline.types.d.ts → components/Polyline.d.ts} +10 -5
  82. package/lib/typescript/src/components/Polyline.d.ts.map +1 -0
  83. package/lib/typescript/src/components/Polyline.web.d.ts +6 -0
  84. package/lib/typescript/src/components/Polyline.web.d.ts.map +1 -0
  85. package/lib/typescript/src/components/index.d.ts +3 -0
  86. package/lib/typescript/src/components/index.d.ts.map +1 -0
  87. package/lib/typescript/src/components/index.web.d.ts +5 -0
  88. package/lib/typescript/src/components/index.web.d.ts.map +1 -0
  89. package/lib/typescript/src/fabric/{LuggMapsAppleMapViewNativeComponent.d.ts → LuggAppleMapViewNativeComponent.d.ts} +10 -3
  90. package/lib/typescript/src/fabric/LuggAppleMapViewNativeComponent.d.ts.map +1 -0
  91. package/lib/typescript/src/fabric/{LuggMapsGoogleMapViewNativeComponent.d.ts → LuggGoogleMapViewNativeComponent.d.ts} +10 -3
  92. package/lib/typescript/src/fabric/LuggGoogleMapViewNativeComponent.d.ts.map +1 -0
  93. package/lib/typescript/src/fabric/{LuggMapsWrapperViewNativeComponent.d.ts → LuggMapWrapperViewNativeComponent.d.ts} +1 -1
  94. package/lib/typescript/src/fabric/LuggMapWrapperViewNativeComponent.d.ts.map +1 -0
  95. package/lib/typescript/src/fabric/{LuggMapsMarkerViewNativeComponent.d.ts → LuggMarkerViewNativeComponent.d.ts} +1 -1
  96. package/lib/typescript/src/fabric/LuggMarkerViewNativeComponent.d.ts.map +1 -0
  97. package/lib/typescript/src/fabric/{LuggMapsPolylineViewNativeComponent.d.ts → LuggPolylineViewNativeComponent.d.ts} +1 -1
  98. package/lib/typescript/src/fabric/LuggPolylineViewNativeComponent.d.ts.map +1 -0
  99. package/lib/typescript/src/index.d.ts +5 -6
  100. package/lib/typescript/src/index.d.ts.map +1 -1
  101. package/lib/typescript/src/index.web.d.ts +7 -0
  102. package/lib/typescript/src/index.web.d.ts.map +1 -0
  103. package/package.json +20 -7
  104. package/plugin/build/index.js +4 -4
  105. package/{lib/typescript/plugin/src/withMapsAndroid.d.ts → plugin/build/withLuggMapsAndroid.d.ts} +0 -1
  106. package/plugin/build/withLuggMapsAndroid.js +15 -0
  107. package/{lib/typescript/plugin/src/withMapsIOS.d.ts → plugin/build/withLuggMapsIOS.d.ts} +0 -1
  108. package/plugin/build/withLuggMapsIOS.js +27 -0
  109. package/plugin/build/withMapsAndroid.d.ts +1 -1
  110. package/plugin/build/withMapsIOS.d.ts +1 -1
  111. package/src/MapProvider.tsx +10 -0
  112. package/src/MapProvider.types.ts +16 -0
  113. package/src/MapProvider.web.tsx +6 -0
  114. package/src/MapView.tsx +27 -10
  115. package/src/MapView.types.ts +24 -15
  116. package/src/MapView.web.tsx +319 -0
  117. package/src/components/Marker.tsx +63 -0
  118. package/src/components/Marker.web.tsx +32 -0
  119. package/src/components/Polyline.tsx +57 -0
  120. package/src/components/Polyline.web.tsx +222 -0
  121. package/src/components/index.ts +2 -0
  122. package/src/components/index.web.ts +4 -0
  123. package/{lib/module/fabric/LuggMapsAppleMapViewNativeComponent.ts → src/fabric/LuggAppleMapViewNativeComponent.ts} +13 -3
  124. package/src/fabric/{LuggMapsGoogleMapViewNativeComponent.ts → LuggGoogleMapViewNativeComponent.ts} +13 -3
  125. package/{lib/module/fabric/LuggMapsWrapperViewNativeComponent.ts → src/fabric/LuggMapWrapperViewNativeComponent.ts} +1 -1
  126. package/src/fabric/{LuggMapsMarkerViewNativeComponent.ts → LuggMarkerViewNativeComponent.ts} +1 -1
  127. package/{lib/module/fabric/LuggMapsPolylineViewNativeComponent.ts → src/fabric/LuggPolylineViewNativeComponent.ts} +1 -1
  128. package/src/index.ts +11 -7
  129. package/src/index.web.ts +17 -0
  130. package/android/src/main/java/com/luggmaps/LuggMapsWrapperViewManager.kt +0 -25
  131. package/lib/module/Marker.js.map +0 -1
  132. package/lib/module/Marker.types.js +0 -4
  133. package/lib/module/Marker.types.js.map +0 -1
  134. package/lib/module/Polyline.js.map +0 -1
  135. package/lib/module/Polyline.types.js +0 -4
  136. package/lib/module/Polyline.types.js.map +0 -1
  137. package/lib/typescript/plugin/src/withMapsAndroid.d.ts.map +0 -1
  138. package/lib/typescript/plugin/src/withMapsIOS.d.ts.map +0 -1
  139. package/lib/typescript/src/Marker.d.ts.map +0 -1
  140. package/lib/typescript/src/Marker.types.d.ts.map +0 -1
  141. package/lib/typescript/src/Polyline.d.ts +0 -6
  142. package/lib/typescript/src/Polyline.d.ts.map +0 -1
  143. package/lib/typescript/src/Polyline.types.d.ts.map +0 -1
  144. package/lib/typescript/src/fabric/LuggMapsAppleMapViewNativeComponent.d.ts.map +0 -1
  145. package/lib/typescript/src/fabric/LuggMapsGoogleMapViewNativeComponent.d.ts.map +0 -1
  146. package/lib/typescript/src/fabric/LuggMapsMarkerViewNativeComponent.d.ts.map +0 -1
  147. package/lib/typescript/src/fabric/LuggMapsPolylineViewNativeComponent.d.ts.map +0 -1
  148. package/lib/typescript/src/fabric/LuggMapsWrapperViewNativeComponent.d.ts.map +0 -1
  149. package/src/Marker.tsx +0 -31
  150. package/src/Marker.types.ts +0 -32
  151. package/src/Polyline.tsx +0 -32
  152. package/src/Polyline.types.ts +0 -24
@@ -1,10 +1,11 @@
1
- #import "LuggMapsGoogleMapView.h"
2
- #import "LuggMapsMarkerView.h"
3
- #import "LuggMapsPolylineView.h"
1
+ #import "LuggGoogleMapView.h"
2
+ #import "LuggMarkerView.h"
3
+ #import "LuggPolylineView.h"
4
4
  #import "core/GMSPolylineAnimator.h"
5
5
  #import "core/PolylineAnimatorBase.h"
6
6
  #import "events/CameraIdleEvent.h"
7
7
  #import "events/CameraMoveEvent.h"
8
+ #import "events/ReadyEvent.h"
8
9
 
9
10
  #import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
10
11
  #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
@@ -16,35 +17,35 @@
16
17
  using namespace facebook::react;
17
18
  using namespace luggmaps::events;
18
19
 
19
- #import "LuggMapsWrapperView.h"
20
+ #import "LuggMapWrapperView.h"
20
21
 
21
22
  static NSString *const kDemoMapId = @"DEMO_MAP_ID";
22
23
 
23
- @interface LuggMapsGoogleMapView () <
24
- RCTLuggMapsGoogleMapViewViewProtocol, GMSMapViewDelegate,
25
- LuggMapsMarkerViewDelegate, LuggMapsPolylineViewDelegate>
24
+ @interface LuggGoogleMapView () <RCTLuggGoogleMapViewViewProtocol,
25
+ GMSMapViewDelegate, LuggMarkerViewDelegate,
26
+ LuggPolylineViewDelegate>
26
27
  @end
27
28
 
28
- @implementation LuggMapsGoogleMapView {
29
+ @implementation LuggGoogleMapView {
29
30
  GMSMapView *_mapView;
30
- LuggMapsWrapperView *_mapWrapperView;
31
+ LuggMapWrapperView *_mapWrapperView;
31
32
  BOOL _isMapReady;
32
33
  BOOL _isDragging;
33
34
  NSString *_mapId;
34
- NSMutableArray<LuggMapsMarkerView *> *_pendingMarkerViews;
35
- NSMutableArray<LuggMapsPolylineView *> *_pendingPolylineViews;
36
- NSMapTable<LuggMapsPolylineView *, GMSPolylineAnimator *> *_polylineAnimators;
35
+ NSMutableArray<LuggMarkerView *> *_pendingMarkerViews;
36
+ NSMutableArray<LuggPolylineView *> *_pendingPolylineViews;
37
+ NSMapTable<LuggPolylineView *, GMSPolylineAnimator *> *_polylineAnimators;
37
38
  }
38
39
 
39
40
  + (ComponentDescriptorProvider)componentDescriptorProvider {
40
41
  return concreteComponentDescriptorProvider<
41
- LuggMapsGoogleMapViewComponentDescriptor>();
42
+ LuggGoogleMapViewComponentDescriptor>();
42
43
  }
43
44
 
44
45
  - (instancetype)initWithFrame:(CGRect)frame {
45
46
  if (self = [super initWithFrame:frame]) {
46
47
  static const auto defaultProps =
47
- std::make_shared<const LuggMapsGoogleMapViewProps>();
48
+ std::make_shared<const LuggGoogleMapViewProps>();
48
49
  _props = defaultProps;
49
50
 
50
51
  _isMapReady = NO;
@@ -64,15 +65,14 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
64
65
  index:(NSInteger)index {
65
66
  [super mountChildComponentView:childComponentView index:index];
66
67
 
67
- if ([childComponentView isKindOfClass:[LuggMapsWrapperView class]]) {
68
- _mapWrapperView = (LuggMapsWrapperView *)childComponentView;
69
- } else if ([childComponentView isKindOfClass:[LuggMapsMarkerView class]]) {
70
- LuggMapsMarkerView *markerView = (LuggMapsMarkerView *)childComponentView;
68
+ if ([childComponentView isKindOfClass:[LuggMapWrapperView class]]) {
69
+ _mapWrapperView = (LuggMapWrapperView *)childComponentView;
70
+ } else if ([childComponentView isKindOfClass:[LuggMarkerView class]]) {
71
+ LuggMarkerView *markerView = (LuggMarkerView *)childComponentView;
71
72
  markerView.delegate = self;
72
73
  [self syncMarkerView:markerView caller:@"mountChildComponentView"];
73
- } else if ([childComponentView isKindOfClass:[LuggMapsPolylineView class]]) {
74
- LuggMapsPolylineView *polylineView =
75
- (LuggMapsPolylineView *)childComponentView;
74
+ } else if ([childComponentView isKindOfClass:[LuggPolylineView class]]) {
75
+ LuggPolylineView *polylineView = (LuggPolylineView *)childComponentView;
76
76
  polylineView.delegate = self;
77
77
  [self syncPolylineView:polylineView];
78
78
  }
@@ -81,17 +81,16 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
81
81
  - (void)unmountChildComponentView:
82
82
  (UIView<RCTComponentViewProtocol> *)childComponentView
83
83
  index:(NSInteger)index {
84
- if ([childComponentView isKindOfClass:[LuggMapsMarkerView class]]) {
85
- LuggMapsMarkerView *markerView = (LuggMapsMarkerView *)childComponentView;
84
+ if ([childComponentView isKindOfClass:[LuggMarkerView class]]) {
85
+ LuggMarkerView *markerView = (LuggMarkerView *)childComponentView;
86
86
  GMSAdvancedMarker *marker = (GMSAdvancedMarker *)markerView.marker;
87
87
  if (marker) {
88
88
  marker.iconView = nil;
89
89
  marker.map = nil;
90
90
  markerView.marker = nil;
91
91
  }
92
- } else if ([childComponentView isKindOfClass:[LuggMapsPolylineView class]]) {
93
- LuggMapsPolylineView *polylineView =
94
- (LuggMapsPolylineView *)childComponentView;
92
+ } else if ([childComponentView isKindOfClass:[LuggPolylineView class]]) {
93
+ LuggPolylineView *polylineView = (LuggPolylineView *)childComponentView;
95
94
  [_polylineAnimators removeObjectForKey:polylineView];
96
95
  GMSPolyline *polyline = (GMSPolyline *)polylineView.polyline;
97
96
  if (polyline) {
@@ -131,7 +130,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
131
130
  }
132
131
 
133
132
  const auto &viewProps =
134
- *std::static_pointer_cast<LuggMapsGoogleMapViewProps const>(_props);
133
+ *std::static_pointer_cast<LuggGoogleMapViewProps const>(_props);
135
134
 
136
135
  GMSMapID *gmsMapId;
137
136
  if ([_mapId isEqualToString:kDemoMapId] || _mapId.length == 0) {
@@ -160,12 +159,26 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
160
159
  _mapView.settings.scrollGestures = viewProps.scrollEnabled;
161
160
  _mapView.settings.rotateGestures = viewProps.rotateEnabled;
162
161
  _mapView.settings.tiltGestures = viewProps.pitchEnabled;
162
+ _mapView.myLocationEnabled = viewProps.userLocationEnabled;
163
+
164
+ if (viewProps.minZoom > 0) {
165
+ [_mapView setMinZoom:(float)viewProps.minZoom maxZoom:_mapView.maxZoom];
166
+ }
167
+ if (viewProps.maxZoom > 0) {
168
+ [_mapView setMinZoom:_mapView.minZoom maxZoom:(float)viewProps.maxZoom];
169
+ }
170
+
171
+ _mapView.padding =
172
+ UIEdgeInsetsMake(viewProps.padding.top, viewProps.padding.left,
173
+ viewProps.padding.bottom, viewProps.padding.right);
163
174
 
164
175
  [_mapWrapperView addSubview:_mapView];
165
176
 
166
177
  _isMapReady = YES;
167
178
  [self processPendingMarkers];
168
179
  [self processPendingPolylines];
180
+
181
+ ReadyEvent::emit<LuggGoogleMapViewEventEmitter>(_eventEmitter);
169
182
  }
170
183
 
171
184
  - (GMSMapView *)mapView {
@@ -180,49 +193,39 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
180
193
 
181
194
  - (void)mapView:(GMSMapView *)mapView
182
195
  didChangeCameraPosition:(GMSCameraPosition *)position {
183
- if (_eventEmitter) {
184
- auto emitter =
185
- std::static_pointer_cast<LuggMapsGoogleMapViewEventEmitter const>(
186
- _eventEmitter);
187
- CameraMoveEvent{position.target.latitude, position.target.longitude,
188
- position.zoom, _isDragging}
189
- .emit(emitter);
190
- }
196
+ CameraMoveEvent{position.target.latitude, position.target.longitude,
197
+ position.zoom, _isDragging}
198
+ .emit<LuggGoogleMapViewEventEmitter>(_eventEmitter);
191
199
  }
192
200
 
193
201
  - (void)mapView:(GMSMapView *)mapView
194
202
  idleAtCameraPosition:(GMSCameraPosition *)position {
203
+ BOOL wasDragging = _isDragging;
195
204
  _isDragging = NO;
196
- if (_eventEmitter) {
197
- auto emitter =
198
- std::static_pointer_cast<LuggMapsGoogleMapViewEventEmitter const>(
199
- _eventEmitter);
200
- CameraIdleEvent{position.target.latitude, position.target.longitude,
201
- position.zoom}
202
- .emit(emitter);
203
- }
205
+ CameraIdleEvent{position.target.latitude, position.target.longitude,
206
+ position.zoom, static_cast<bool>(wasDragging)}
207
+ .emit<LuggGoogleMapViewEventEmitter>(_eventEmitter);
204
208
  }
205
209
 
206
210
  #pragma mark - PolylineViewDelegate
207
211
 
208
- - (void)polylineViewDidUpdate:(LuggMapsPolylineView *)polylineView {
212
+ - (void)polylineViewDidUpdate:(LuggPolylineView *)polylineView {
209
213
  [self syncPolylineView:polylineView];
210
214
  }
211
215
 
212
216
  #pragma mark - MarkerViewDelegate
213
217
 
214
- - (void)markerViewDidLayout:(LuggMapsMarkerView *)markerView {
218
+ - (void)markerViewDidLayout:(LuggMarkerView *)markerView {
215
219
  [self syncMarkerView:markerView caller:@"markerViewDidLayout"];
216
220
  }
217
221
 
218
- - (void)markerViewDidUpdate:(LuggMapsMarkerView *)markerView {
222
+ - (void)markerViewDidUpdate:(LuggMarkerView *)markerView {
219
223
  [self syncMarkerView:markerView caller:@"markerViewDidUpdate"];
220
224
  }
221
225
 
222
226
  #pragma mark - Marker Management
223
227
 
224
- - (void)syncMarkerView:(LuggMapsMarkerView *)markerView
225
- caller:(NSString *)caller {
228
+ - (void)syncMarkerView:(LuggMarkerView *)markerView caller:(NSString *)caller {
226
229
  if (!_mapView) {
227
230
  if (![_pendingMarkerViews containsObject:markerView]) {
228
231
  [_pendingMarkerViews addObject:markerView];
@@ -239,14 +242,15 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
239
242
  marker.position = markerView.coordinate;
240
243
  marker.title = markerView.title;
241
244
  marker.snippet = markerView.markerDescription;
242
- marker.groundAnchor = markerView.anchor;
243
-
245
+ marker.zIndex = (int)markerView.zIndex;
244
246
  if (markerView.hasCustomView) {
245
247
  UIView *iconView = markerView.iconView;
246
248
  [iconView removeFromSuperview];
247
249
  marker.iconView = iconView;
250
+ marker.groundAnchor = markerView.anchor;
248
251
  } else {
249
252
  marker.iconView = nil;
253
+ marker.groundAnchor = CGPointMake(0.5, 1);
250
254
  }
251
255
  }
252
256
 
@@ -255,15 +259,15 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
255
259
  return;
256
260
  }
257
261
 
258
- for (LuggMapsMarkerView *markerView in _pendingMarkerViews) {
262
+ for (LuggMarkerView *markerView in _pendingMarkerViews) {
259
263
  [self addMarkerViewToMap:markerView];
260
264
  }
261
265
  [_pendingMarkerViews removeAllObjects];
262
266
  }
263
267
 
264
- - (void)addMarkerViewToMap:(LuggMapsMarkerView *)markerView {
268
+ - (void)addMarkerViewToMap:(LuggMarkerView *)markerView {
265
269
  if (!_mapView) {
266
- RCTLogWarn(@"LuggMaps: addMarkerViewToMap called without a map");
270
+ RCTLogWarn(@"Lugg: addMarkerViewToMap called without a map");
267
271
  return;
268
272
  }
269
273
 
@@ -274,13 +278,13 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
274
278
  marker.position = markerView.coordinate;
275
279
  marker.title = markerView.title;
276
280
  marker.snippet = markerView.markerDescription;
277
- marker.collisionBehavior = GMSCollisionBehaviorRequired;
278
281
 
279
282
  if (markerView.hasCustomView) {
280
283
  marker.iconView = iconView;
284
+ marker.groundAnchor = markerView.anchor;
281
285
  }
282
286
 
283
- marker.groundAnchor = markerView.anchor;
287
+ marker.zIndex = (int)markerView.zIndex;
284
288
  marker.map = _mapView;
285
289
 
286
290
  markerView.marker = marker;
@@ -288,7 +292,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
288
292
 
289
293
  #pragma mark - Polyline Management
290
294
 
291
- - (void)syncPolylineView:(LuggMapsPolylineView *)polylineView {
295
+ - (void)syncPolylineView:(LuggPolylineView *)polylineView {
292
296
  if (!_mapView) {
293
297
  if (![_pendingPolylineViews containsObject:polylineView]) {
294
298
  [_pendingPolylineViews addObject:polylineView];
@@ -303,6 +307,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
303
307
 
304
308
  GMSPolyline *polyline = (GMSPolyline *)polylineView.polyline;
305
309
  polyline.strokeWidth = polylineView.strokeWidth;
310
+ polyline.zIndex = (int)polylineView.zIndex;
306
311
 
307
312
  GMSPolylineAnimator *animator =
308
313
  [_polylineAnimators objectForKey:polylineView];
@@ -319,19 +324,20 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
319
324
  return;
320
325
  }
321
326
 
322
- for (LuggMapsPolylineView *polylineView in _pendingPolylineViews) {
327
+ for (LuggPolylineView *polylineView in _pendingPolylineViews) {
323
328
  [self addPolylineViewToMap:polylineView];
324
329
  }
325
330
  [_pendingPolylineViews removeAllObjects];
326
331
  }
327
332
 
328
- - (void)addPolylineViewToMap:(LuggMapsPolylineView *)polylineView {
333
+ - (void)addPolylineViewToMap:(LuggPolylineView *)polylineView {
329
334
  if (!_mapView) {
330
335
  return;
331
336
  }
332
337
 
333
338
  GMSPolyline *polyline = [GMSPolyline polylineWithPath:[GMSMutablePath path]];
334
339
  polyline.strokeWidth = polylineView.strokeWidth;
340
+ polyline.zIndex = (int)polylineView.zIndex;
335
341
  polyline.map = _mapView;
336
342
  polylineView.polyline = polyline;
337
343
 
@@ -350,7 +356,7 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
350
356
  - (void)updateProps:(Props::Shared const &)props
351
357
  oldProps:(Props::Shared const &)oldProps {
352
358
  const auto &newViewProps =
353
- *std::static_pointer_cast<LuggMapsGoogleMapViewProps const>(props);
359
+ *std::static_pointer_cast<LuggGoogleMapViewProps const>(props);
354
360
 
355
361
  if (_mapView == nil) {
356
362
  NSString *newMapId =
@@ -365,9 +371,16 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
365
371
  _mapView.settings.scrollGestures = newViewProps.scrollEnabled;
366
372
  _mapView.settings.rotateGestures = newViewProps.rotateEnabled;
367
373
  _mapView.settings.tiltGestures = newViewProps.pitchEnabled;
374
+ _mapView.myLocationEnabled = newViewProps.userLocationEnabled;
368
375
  _mapView.padding = UIEdgeInsetsMake(
369
376
  newViewProps.padding.top, newViewProps.padding.left,
370
377
  newViewProps.padding.bottom, newViewProps.padding.right);
378
+
379
+ float minZoom = newViewProps.minZoom > 0 ? (float)newViewProps.minZoom
380
+ : _mapView.minZoom;
381
+ float maxZoom = newViewProps.maxZoom > 0 ? (float)newViewProps.maxZoom
382
+ : _mapView.maxZoom;
383
+ [_mapView setMinZoom:minZoom maxZoom:maxZoom];
371
384
  }
372
385
 
373
386
  [super updateProps:props oldProps:oldProps];
@@ -400,7 +413,10 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
400
413
  }
401
414
 
402
415
  - (void)fitCoordinates:(NSArray *)coordinates
403
- padding:(double)padding
416
+ paddingTop:(double)paddingTop
417
+ paddingLeft:(double)paddingLeft
418
+ paddingBottom:(double)paddingBottom
419
+ paddingRight:(double)paddingRight
404
420
  duration:(double)duration {
405
421
  if (!_mapView || coordinates.count == 0) {
406
422
  return;
@@ -413,8 +429,10 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
413
429
  bounds = [bounds includingCoordinate:CLLocationCoordinate2DMake(lat, lng)];
414
430
  }
415
431
 
432
+ UIEdgeInsets edgePadding =
433
+ UIEdgeInsetsMake(paddingTop, paddingLeft, paddingBottom, paddingRight);
416
434
  GMSCameraUpdate *cameraUpdate = [GMSCameraUpdate fitBounds:bounds
417
- withPadding:padding];
435
+ withEdgeInsets:edgePadding];
418
436
 
419
437
  if (duration < 0) {
420
438
  [_mapView animateWithCameraUpdate:cameraUpdate];
@@ -429,11 +447,11 @@ static NSString *const kDemoMapId = @"DEMO_MAP_ID";
429
447
  }
430
448
 
431
449
  - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args {
432
- RCTLuggMapsGoogleMapViewHandleCommand(self, commandName, args);
450
+ RCTLuggGoogleMapViewHandleCommand(self, commandName, args);
433
451
  }
434
452
 
435
- Class<RCTComponentViewProtocol> LuggMapsGoogleMapViewCls(void) {
436
- return LuggMapsGoogleMapView.class;
453
+ Class<RCTComponentViewProtocol> LuggGoogleMapViewCls(void) {
454
+ return LuggGoogleMapView.class;
437
455
  }
438
456
 
439
457
  @end
@@ -3,7 +3,7 @@
3
3
 
4
4
  NS_ASSUME_NONNULL_BEGIN
5
5
 
6
- @interface LuggMapsWrapperView : RCTViewComponentView
6
+ @interface LuggMapWrapperView : RCTViewComponentView
7
7
  @end
8
8
 
9
9
  NS_ASSUME_NONNULL_END
@@ -1,4 +1,4 @@
1
- #import "LuggMapsWrapperView.h"
1
+ #import "LuggMapWrapperView.h"
2
2
 
3
3
  #import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
4
4
  #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
@@ -9,28 +9,28 @@
9
9
 
10
10
  using namespace facebook::react;
11
11
 
12
- @interface LuggMapsWrapperView () <RCTLuggMapsWrapperViewViewProtocol>
12
+ @interface LuggMapWrapperView () <RCTLuggMapWrapperViewViewProtocol>
13
13
  @end
14
14
 
15
- @implementation LuggMapsWrapperView
15
+ @implementation LuggMapWrapperView
16
16
 
17
17
  + (ComponentDescriptorProvider)componentDescriptorProvider {
18
18
  return concreteComponentDescriptorProvider<
19
- LuggMapsWrapperViewComponentDescriptor>();
19
+ LuggMapWrapperViewComponentDescriptor>();
20
20
  }
21
21
 
22
22
  - (instancetype)initWithFrame:(CGRect)frame {
23
23
  if (self = [super initWithFrame:frame]) {
24
24
  static const auto defaultProps =
25
- std::make_shared<const LuggMapsWrapperViewProps>();
25
+ std::make_shared<const LuggMapWrapperViewProps>();
26
26
  _props = defaultProps;
27
27
  }
28
28
 
29
29
  return self;
30
30
  }
31
31
 
32
- Class<RCTComponentViewProtocol> LuggMapsWrapperViewCls(void) {
33
- return LuggMapsWrapperView.class;
32
+ Class<RCTComponentViewProtocol> LuggMapWrapperViewCls(void) {
33
+ return LuggMapWrapperView.class;
34
34
  }
35
35
 
36
36
  @end
@@ -4,24 +4,26 @@
4
4
 
5
5
  NS_ASSUME_NONNULL_BEGIN
6
6
 
7
- @class LuggMapsMarkerView;
7
+ @class LuggMarkerView;
8
8
 
9
- @protocol LuggMapsMarkerViewDelegate <NSObject>
9
+ @protocol LuggMarkerViewDelegate <NSObject>
10
10
  @optional
11
- - (void)markerViewDidLayout:(LuggMapsMarkerView *)markerView;
12
- - (void)markerViewDidUpdate:(LuggMapsMarkerView *)markerView;
11
+ - (void)markerViewDidLayout:(LuggMarkerView *)markerView;
12
+ - (void)markerViewDidUpdate:(LuggMarkerView *)markerView;
13
13
  @end
14
14
 
15
- @interface LuggMapsMarkerView : RCTViewComponentView
15
+ @interface LuggMarkerView : RCTViewComponentView
16
16
 
17
+ @property(nonatomic, readonly, nullable) NSString *name;
17
18
  @property(nonatomic, readonly) CLLocationCoordinate2D coordinate;
18
19
  @property(nonatomic, readonly, nullable) NSString *title;
19
20
  @property(nonatomic, readonly, nullable) NSString *markerDescription;
20
21
  @property(nonatomic, readonly) CGPoint anchor;
22
+ @property(nonatomic, readonly) NSInteger zIndex;
21
23
  @property(nonatomic, readonly) BOOL hasCustomView;
22
24
  @property(nonatomic, readonly) BOOL didLayout;
23
25
  @property(nonatomic, readonly) UIView *iconView;
24
- @property(nonatomic, weak, nullable) id<LuggMapsMarkerViewDelegate> delegate;
26
+ @property(nonatomic, weak, nullable) id<LuggMarkerViewDelegate> delegate;
25
27
  @property(nonatomic, strong, nullable) NSObject *marker;
26
28
 
27
29
  @end
@@ -1,4 +1,4 @@
1
- #import "LuggMapsMarkerView.h"
1
+ #import "LuggMarkerView.h"
2
2
 
3
3
  #import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
4
4
  #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
@@ -9,31 +9,34 @@
9
9
 
10
10
  using namespace facebook::react;
11
11
 
12
- @interface LuggMapsMarkerView () <RCTLuggMapsMarkerViewViewProtocol>
12
+ @interface LuggMarkerView () <RCTLuggMarkerViewViewProtocol>
13
13
  @end
14
14
 
15
- @implementation LuggMapsMarkerView {
15
+ @implementation LuggMarkerView {
16
+ NSString *_name;
16
17
  CLLocationCoordinate2D _coordinate;
17
18
  NSString *_title;
18
19
  NSString *_markerDescription;
19
20
  CGPoint _anchor;
21
+ NSInteger _zIndex;
20
22
  BOOL _didLayout;
21
23
  UIView *_iconView;
22
24
  }
23
25
 
24
26
  + (ComponentDescriptorProvider)componentDescriptorProvider {
25
27
  return concreteComponentDescriptorProvider<
26
- LuggMapsMarkerViewComponentDescriptor>();
28
+ LuggMarkerViewComponentDescriptor>();
27
29
  }
28
30
 
29
31
  - (instancetype)initWithFrame:(CGRect)frame {
30
32
  if (self = [super initWithFrame:frame]) {
31
33
  static const auto defaultProps =
32
- std::make_shared<const LuggMapsMarkerViewProps>();
34
+ std::make_shared<const LuggMarkerViewProps>();
33
35
  _props = defaultProps;
34
36
 
35
37
  _coordinate = CLLocationCoordinate2DMake(0, 0);
36
38
  _anchor = CGPointMake(0.5, 1.0);
39
+ _zIndex = 0;
37
40
  _didLayout = NO;
38
41
 
39
42
  _iconView = [[UIView alloc] init];
@@ -50,14 +53,16 @@ using namespace facebook::react;
50
53
  oldProps:(Props::Shared const &)oldProps {
51
54
  [super updateProps:props oldProps:oldProps];
52
55
  const auto &newViewProps =
53
- *std::static_pointer_cast<LuggMapsMarkerViewProps const>(props);
56
+ *std::static_pointer_cast<LuggMarkerViewProps const>(props);
54
57
 
58
+ _name = [NSString stringWithUTF8String:newViewProps.name.c_str()];
55
59
  _coordinate = CLLocationCoordinate2DMake(newViewProps.coordinate.latitude,
56
60
  newViewProps.coordinate.longitude);
57
61
  _title = [NSString stringWithUTF8String:newViewProps.title.c_str()];
58
62
  _markerDescription =
59
63
  [NSString stringWithUTF8String:newViewProps.description.c_str()];
60
64
  _anchor = CGPointMake(newViewProps.anchor.x, newViewProps.anchor.y);
65
+ _zIndex = newViewProps.zIndex.value_or(0);
61
66
  }
62
67
 
63
68
  - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
@@ -109,6 +114,10 @@ using namespace facebook::react;
109
114
  }
110
115
  }
111
116
 
117
+ - (NSString *)name {
118
+ return _name;
119
+ }
120
+
112
121
  - (CLLocationCoordinate2D)coordinate {
113
122
  return _coordinate;
114
123
  }
@@ -125,6 +134,10 @@ using namespace facebook::react;
125
134
  return _anchor;
126
135
  }
127
136
 
137
+ - (NSInteger)zIndex {
138
+ return _zIndex;
139
+ }
140
+
128
141
  - (BOOL)hasCustomView {
129
142
  return _iconView.subviews.count > 0;
130
143
  }
@@ -147,8 +160,8 @@ using namespace facebook::react;
147
160
  }
148
161
  }
149
162
 
150
- Class<RCTComponentViewProtocol> LuggMapsMarkerViewCls(void) {
151
- return LuggMapsMarkerView.class;
163
+ Class<RCTComponentViewProtocol> LuggMarkerViewCls(void) {
164
+ return LuggMarkerView.class;
152
165
  }
153
166
 
154
167
  @end
@@ -4,20 +4,21 @@
4
4
 
5
5
  NS_ASSUME_NONNULL_BEGIN
6
6
 
7
- @class LuggMapsPolylineView;
7
+ @class LuggPolylineView;
8
8
 
9
- @protocol LuggMapsPolylineViewDelegate <NSObject>
9
+ @protocol LuggPolylineViewDelegate <NSObject>
10
10
  @optional
11
- - (void)polylineViewDidUpdate:(LuggMapsPolylineView *)polylineView;
11
+ - (void)polylineViewDidUpdate:(LuggPolylineView *)polylineView;
12
12
  @end
13
13
 
14
- @interface LuggMapsPolylineView : RCTViewComponentView
14
+ @interface LuggPolylineView : RCTViewComponentView
15
15
 
16
16
  @property(nonatomic, readonly) NSArray<CLLocation *> *coordinates;
17
17
  @property(nonatomic, readonly) NSArray<UIColor *> *strokeColors;
18
18
  @property(nonatomic, readonly) BOOL animated;
19
19
  @property(nonatomic, readonly) CGFloat strokeWidth;
20
- @property(nonatomic, weak, nullable) id<LuggMapsPolylineViewDelegate> delegate;
20
+ @property(nonatomic, readonly) NSInteger zIndex;
21
+ @property(nonatomic, weak, nullable) id<LuggPolylineViewDelegate> delegate;
21
22
  @property(nonatomic, strong, nullable) NSObject *polyline;
22
23
  @property(nonatomic, weak, nullable) NSObject *renderer;
23
24
  @property(nonatomic, strong, nullable) NSArray *cachedSpans;
@@ -1,4 +1,4 @@
1
- #import "LuggMapsPolylineView.h"
1
+ #import "LuggPolylineView.h"
2
2
 
3
3
  #import <react/renderer/components/RNMapsSpec/ComponentDescriptors.h>
4
4
  #import <react/renderer/components/RNMapsSpec/EventEmitters.h>
@@ -10,25 +10,26 @@
10
10
 
11
11
  using namespace facebook::react;
12
12
 
13
- @interface LuggMapsPolylineView () <RCTLuggMapsPolylineViewViewProtocol>
13
+ @interface LuggPolylineView () <RCTLuggPolylineViewViewProtocol>
14
14
  @end
15
15
 
16
- @implementation LuggMapsPolylineView {
16
+ @implementation LuggPolylineView {
17
17
  NSArray<CLLocation *> *_coordinates;
18
18
  NSArray<UIColor *> *_strokeColors;
19
19
  BOOL _animated;
20
20
  CGFloat _strokeWidth;
21
+ NSInteger _zIndex;
21
22
  }
22
23
 
23
24
  + (ComponentDescriptorProvider)componentDescriptorProvider {
24
25
  return concreteComponentDescriptorProvider<
25
- LuggMapsPolylineViewComponentDescriptor>();
26
+ LuggPolylineViewComponentDescriptor>();
26
27
  }
27
28
 
28
29
  - (instancetype)initWithFrame:(CGRect)frame {
29
30
  if (self = [super initWithFrame:frame]) {
30
31
  static const auto defaultProps =
31
- std::make_shared<const LuggMapsPolylineViewProps>();
32
+ std::make_shared<const LuggPolylineViewProps>();
32
33
  _props = defaultProps;
33
34
 
34
35
  _coordinates = @[];
@@ -45,7 +46,7 @@ using namespace facebook::react;
45
46
  oldProps:(Props::Shared const &)oldProps {
46
47
  [super updateProps:props oldProps:oldProps];
47
48
  const auto &newViewProps =
48
- *std::static_pointer_cast<LuggMapsPolylineViewProps const>(props);
49
+ *std::static_pointer_cast<LuggPolylineViewProps const>(props);
49
50
 
50
51
  NSMutableArray<CLLocation *> *coords = [NSMutableArray array];
51
52
  for (const auto &coord : newViewProps.coordinates) {
@@ -71,8 +72,8 @@ using namespace facebook::react;
71
72
  }
72
73
 
73
74
  _animated = newViewProps.animated;
74
-
75
75
  _strokeWidth = newViewProps.strokeWidth > 0 ? newViewProps.strokeWidth : 1.0;
76
+ _zIndex = newViewProps.zIndex.value_or(0);
76
77
  }
77
78
 
78
79
  - (void)finalizeUpdates:(RNComponentViewUpdateMask)updateMask {
@@ -101,6 +102,10 @@ using namespace facebook::react;
101
102
  return _strokeWidth;
102
103
  }
103
104
 
105
+ - (NSInteger)zIndex {
106
+ return _zIndex;
107
+ }
108
+
104
109
  - (void)prepareForRecycle {
105
110
  [super prepareForRecycle];
106
111
  self.polyline = nil;
@@ -109,8 +114,8 @@ using namespace facebook::react;
109
114
  self.delegate = nil;
110
115
  }
111
116
 
112
- Class<RCTComponentViewProtocol> LuggMapsPolylineViewCls(void) {
113
- return LuggMapsPolylineView.class;
117
+ Class<RCTComponentViewProtocol> LuggPolylineViewCls(void) {
118
+ return LuggPolylineView.class;
114
119
  }
115
120
 
116
121
  @end