react-native-maps 1.28.2 → 1.29.0

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 (38) hide show
  1. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
  2. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +2 -0
  3. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +175 -0
  4. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +157 -0
  5. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +183 -0
  6. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +431 -0
  7. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +2 -0
  8. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +22 -0
  9. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +4 -0
  10. package/dist/src/specs/NativeComponentGoogleMarker.d.ts +250 -0
  11. package/dist/src/specs/NativeComponentPolygon.d.ts +108 -0
  12. package/dist/tsconfig.build.tsbuildinfo +1 -1
  13. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +3 -0
  14. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +6 -2
  15. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +8 -0
  16. package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.h +28 -0
  17. package/ios/AirGoogleMaps/RNMapsGoogleMarkerView.mm +357 -0
  18. package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.h +24 -0
  19. package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMarkerView.mm +64 -0
  20. package/ios/AirMaps/RNMapsMapView.mm +8 -0
  21. package/ios/AirMaps/RNMapsPolygonView.h +26 -0
  22. package/ios/AirMaps/RNMapsPolygonView.mm +240 -0
  23. package/ios/generated/RCTThirdPartyComponentsProvider.mm +2 -0
  24. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
  25. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
  26. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +175 -0
  27. package/ios/generated/RNMapsSpecs/EventEmitters.h +157 -0
  28. package/ios/generated/RNMapsSpecs/Props.cpp +178 -0
  29. package/ios/generated/RNMapsSpecs/Props.h +379 -0
  30. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +143 -0
  31. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
  32. package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
  33. package/ios/generated/RNMapsSpecs/States.h +4 -0
  34. package/package.json +4 -2
  35. package/src/MapMarker.tsx +4 -3
  36. package/src/decorateMapComponent.ts +29 -15
  37. package/src/specs/NativeComponentGoogleMarker.ts +327 -0
  38. package/src/specs/NativeComponentPolygon.ts +137 -0
@@ -0,0 +1,357 @@
1
+ //
2
+ // RNMapsGoogleMarkerView.mm
3
+ // AirGoogleMaps
4
+ //
5
+ // Fabric component view for the Google Maps marker on iOS.
6
+ // Mirrors `RNMapsMarkerView` (Apple) but wraps the legacy `AIRGoogleMapMarker`.
7
+ //
8
+ // Copyright © 2024 react-native-maps. All rights reserved.
9
+ //
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
+ #ifdef HAVE_GOOGLE_MAPS
12
+
13
+ #import "RNMapsGoogleMarkerView.h"
14
+ #import "AIRGoogleMapMarker.h"
15
+ #import "AIRGoogleMapMarkerManager.h"
16
+ #import "AIRGoogleMap.h"
17
+ #if __has_include(<ReactNativeMaps/generated/RNMapsAirModuleDelegate.h>)
18
+ #import <ReactNativeMaps/generated/RNMapsHostViewDelegate.h>
19
+ #import <ReactNativeMaps/generated/ComponentDescriptors.h>
20
+ #import <ReactNativeMaps/generated/EventEmitters.h>
21
+ #import <ReactNativeMaps/generated/Props.h>
22
+ #import <ReactNativeMaps/generated/RCTComponentViewHelpers.h>
23
+ #else
24
+ #import "../generated/RNMapsHostViewDelegate.h"
25
+ #import "../generated/RNMapsSpecs/ComponentDescriptors.h"
26
+ #import "../generated/RNMapsSpecs/EventEmitters.h"
27
+ #import "../generated/RNMapsSpecs/Props.h"
28
+ #import "../generated/RNMapsSpecs/RCTComponentViewHelpers.h"
29
+ #endif
30
+ #import "RCTFabricComponentsPlugins.h"
31
+ #import <React/RCTConversions.h>
32
+ #import "UIView+AirMap.h"
33
+
34
+ using namespace facebook::react;
35
+
36
+ @interface RNMapsGoogleMarkerView () <RCTRNMapsGoogleMarkerViewProtocol>
37
+ @end
38
+
39
+ @implementation RNMapsGoogleMarkerView {
40
+ AIRGoogleMapMarker *_view;
41
+ AIRGoogleMapMarkerManager *_legacyMarkerManager;
42
+ }
43
+
44
+ - (AIRGoogleMapMarker *)marker {
45
+ return _view;
46
+ }
47
+
48
+ - (void)prepareForRecycle
49
+ {
50
+ [super prepareForRecycle];
51
+ _view = nil;
52
+ _legacyMarkerManager = nil;
53
+ }
54
+
55
+ #pragma mark - Native commands
56
+
57
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
58
+ {
59
+ RCTRNMapsGoogleMarkerHandleCommand(self, commandName, args);
60
+ }
61
+
62
+ + (ComponentDescriptorProvider)componentDescriptorProvider
63
+ {
64
+ return concreteComponentDescriptorProvider<RNMapsGoogleMarkerComponentDescriptor>();
65
+ }
66
+
67
+ - (void)animateToCoordinates:(double)latitude longitude:(double)longitude duration:(NSInteger)duration
68
+ {
69
+ // The Google renderer has no native marker animation; update the coordinate directly.
70
+ [_view setCoordinate:CLLocationCoordinate2DMake(latitude, longitude)];
71
+ }
72
+
73
+ - (void)setCoordinates:(double)latitude longitude:(double)longitude
74
+ {
75
+ [_view setCoordinate:CLLocationCoordinate2DMake(latitude, longitude)];
76
+ }
77
+
78
+ - (void)showCallout
79
+ {
80
+ [_view showCalloutView];
81
+ }
82
+
83
+ - (void)hideCallout
84
+ {
85
+ [_view hideCalloutView];
86
+ }
87
+
88
+ - (void)redraw
89
+ {
90
+ [_view redraw];
91
+ }
92
+
93
+ - (void)redrawCallout
94
+ {
95
+ [_view hideCalloutView];
96
+ [_view showCalloutView];
97
+ }
98
+
99
+ - (void)prepareMarkerView
100
+ {
101
+ if (_view) return;
102
+ static const auto defaultProps = std::make_shared<const RNMapsGoogleMarkerProps>();
103
+ _props = defaultProps;
104
+ _legacyMarkerManager = [[AIRGoogleMapMarkerManager alloc] init];
105
+ _view = (AIRGoogleMapMarker *)[_legacyMarkerManager view];
106
+ // Image/icon loading no longer depends on the instance `bridge`: AIRGoogleMapMarker
107
+ // now loads via the global `[RCTBridge currentBridge]` (bridgeless-safe), matching
108
+ // AIRMapMarker. So there is nothing bridge-related to wire up here.
109
+
110
+ _view.onPress = [self](NSDictionary *dictionary) {
111
+ if (!_eventEmitter) return;
112
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
113
+ NSDictionary *positionDict = dictionary[@"position"];
114
+
115
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnPressCoordinate coordinate = {
116
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
117
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
118
+ };
119
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnPressPosition position = {
120
+ .x = [positionDict[@"x"] doubleValue],
121
+ .y = [positionDict[@"y"] doubleValue],
122
+ };
123
+
124
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
125
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnPress data = {
126
+ .action = std::string([dictionary[@"action"] UTF8String]),
127
+ .id = std::string([dictionary[@"id"] UTF8String]),
128
+ .coordinate = coordinate,
129
+ .position = position,
130
+ };
131
+ eventEmitter->onPress(data);
132
+ };
133
+
134
+ _view.onDragStart = [self](NSDictionary *dictionary) {
135
+ if (!_eventEmitter) return;
136
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
137
+ NSDictionary *positionDict = dictionary[@"position"];
138
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragStartCoordinate coordinate = {
139
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
140
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
141
+ };
142
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragStartPosition position = {
143
+ .x = [positionDict[@"x"] doubleValue],
144
+ .y = [positionDict[@"y"] doubleValue],
145
+ };
146
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
147
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragStart data = {
148
+ .id = std::string([dictionary[@"id"] UTF8String]),
149
+ .coordinate = coordinate,
150
+ .position = position,
151
+ };
152
+ eventEmitter->onDragStart(data);
153
+ };
154
+
155
+ _view.onDrag = [self](NSDictionary *dictionary) {
156
+ if (!_eventEmitter) return;
157
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
158
+ NSDictionary *positionDict = dictionary[@"position"];
159
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragCoordinate coordinate = {
160
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
161
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
162
+ };
163
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragPosition position = {
164
+ .x = [positionDict[@"x"] doubleValue],
165
+ .y = [positionDict[@"y"] doubleValue],
166
+ };
167
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
168
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDrag data = {
169
+ .id = std::string([dictionary[@"id"] UTF8String]),
170
+ .coordinate = coordinate,
171
+ .position = position,
172
+ };
173
+ eventEmitter->onDrag(data);
174
+ };
175
+
176
+ _view.onDragEnd = [self](NSDictionary *dictionary) {
177
+ if (!_eventEmitter) return;
178
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
179
+ NSDictionary *positionDict = dictionary[@"position"];
180
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragEndCoordinate coordinate = {
181
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
182
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
183
+ };
184
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragEndPosition position = {
185
+ .x = [positionDict[@"x"] doubleValue],
186
+ .y = [positionDict[@"y"] doubleValue],
187
+ };
188
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
189
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDragEnd data = {
190
+ .id = std::string([dictionary[@"id"] UTF8String]),
191
+ .coordinate = coordinate,
192
+ .position = position,
193
+ };
194
+ eventEmitter->onDragEnd(data);
195
+ };
196
+
197
+ _view.onSelect = [self](NSDictionary *dictionary) {
198
+ if (!_eventEmitter) return;
199
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
200
+ NSDictionary *positionDict = dictionary[@"position"];
201
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnSelectCoordinate coordinate = {
202
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
203
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
204
+ };
205
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnSelectPosition position = {
206
+ .x = [positionDict[@"x"] doubleValue],
207
+ .y = [positionDict[@"y"] doubleValue],
208
+ };
209
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
210
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnSelect data = {
211
+ .action = std::string([dictionary[@"action"] UTF8String]),
212
+ .id = std::string([dictionary[@"id"] UTF8String]),
213
+ .coordinate = coordinate,
214
+ .position = position,
215
+ };
216
+ eventEmitter->onSelect(data);
217
+ };
218
+
219
+ _view.onDeselect = [self](NSDictionary *dictionary) {
220
+ if (!_eventEmitter) return;
221
+ NSDictionary *coordinateDict = dictionary[@"coordinate"];
222
+ NSDictionary *positionDict = dictionary[@"position"];
223
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDeselectCoordinate coordinate = {
224
+ .latitude = [coordinateDict[@"latitude"] doubleValue],
225
+ .longitude = [coordinateDict[@"longitude"] doubleValue],
226
+ };
227
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDeselectPosition position = {
228
+ .x = [positionDict[@"x"] doubleValue],
229
+ .y = [positionDict[@"y"] doubleValue],
230
+ };
231
+ auto eventEmitter = std::static_pointer_cast<RNMapsGoogleMarkerEventEmitter const>(_eventEmitter);
232
+ facebook::react::RNMapsGoogleMarkerEventEmitter::OnDeselect data = {
233
+ .action = std::string([dictionary[@"action"] UTF8String]),
234
+ .id = std::string([dictionary[@"id"] UTF8String]),
235
+ .coordinate = coordinate,
236
+ .position = position,
237
+ };
238
+ eventEmitter->onDeselect(data);
239
+ };
240
+ }
241
+
242
+ - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
243
+ {
244
+ if (!_view) {
245
+ [self prepareMarkerView];
246
+ }
247
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
248
+ if (paperView) {
249
+ [_view insertReactSubview:paperView atIndex:index];
250
+ } else {
251
+ [_view insertReactSubview:childComponentView atIndex:index];
252
+ }
253
+ }
254
+
255
+ - (void)unmountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index
256
+ {
257
+ id<RCTComponent> paperView = [childComponentView getPaperViewFromChildComponentView];
258
+ if (paperView) {
259
+ [_view removeReactSubview:paperView];
260
+ } else {
261
+ [_view removeReactSubview:childComponentView];
262
+ }
263
+ }
264
+
265
+ - (instancetype)initWithFrame:(CGRect)frame
266
+ {
267
+ if (self = [super initWithFrame:frame]) {
268
+ [self prepareMarkerView];
269
+ }
270
+ return self;
271
+ }
272
+
273
+ - (void)updateProps:(Props::Shared const &)props oldProps:(Props::Shared const &)oldProps
274
+ {
275
+ [self prepareMarkerView];
276
+ const auto &oldViewProps = *std::static_pointer_cast<RNMapsGoogleMarkerProps const>(_props);
277
+ const auto &newViewProps = *std::static_pointer_cast<RNMapsGoogleMarkerProps const>(props);
278
+
279
+ #define REMAP_MARKER_PROP(name) \
280
+ if (oldViewProps.name != newViewProps.name) { \
281
+ _view.name = newViewProps.name; \
282
+ }
283
+
284
+ #define REMAP_MARKER_STRING_PROP(name) \
285
+ if (oldViewProps.name != newViewProps.name) { \
286
+ _view.name = RCTNSStringFromString(newViewProps.name); \
287
+ }
288
+
289
+ #define REMAP_MARKER_POINT_PROP(name) \
290
+ if (newViewProps.name.x != oldViewProps.name.x || \
291
+ newViewProps.name.y != oldViewProps.name.y) { \
292
+ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
293
+ }
294
+
295
+ if (newViewProps.coordinate.latitude != oldViewProps.coordinate.latitude ||
296
+ newViewProps.coordinate.longitude != oldViewProps.coordinate.longitude) {
297
+ _view.coordinate = CLLocationCoordinate2DMake(newViewProps.coordinate.latitude,
298
+ newViewProps.coordinate.longitude);
299
+ }
300
+
301
+ if (newViewProps.zIndex != oldViewProps.zIndex) {
302
+ _view.zIndex = newViewProps.zIndex.has_value() ? newViewProps.zIndex.value() : 0;
303
+ }
304
+
305
+ if (newViewProps.image.uri != oldViewProps.image.uri) {
306
+ if (newViewProps.image.uri.size()) {
307
+ [_view setImageSrc:RCTNSStringFromString(newViewProps.image.uri)];
308
+ } else {
309
+ [_view setImageSrc:nil];
310
+ }
311
+ }
312
+
313
+ if (newViewProps.icon.uri != oldViewProps.icon.uri) {
314
+ if (newViewProps.icon.uri.size()) {
315
+ [_view setIconSrc:RCTNSStringFromString(newViewProps.icon.uri)];
316
+ } else {
317
+ [_view setIconSrc:nil];
318
+ }
319
+ }
320
+
321
+ if (newViewProps.description != oldViewProps.description) {
322
+ _view.subtitle = RCTNSStringFromString(newViewProps.description);
323
+ }
324
+
325
+ if (newViewProps.rotation != oldViewProps.rotation) {
326
+ _view.rotation = newViewProps.rotation;
327
+ }
328
+
329
+ if (newViewProps.pinColor != oldViewProps.pinColor) {
330
+ _view.pinColor = newViewProps.pinColor
331
+ ? RCTUIColorFromSharedColor(newViewProps.pinColor)
332
+ : nil;
333
+ }
334
+
335
+ REMAP_MARKER_STRING_PROP(title)
336
+ REMAP_MARKER_STRING_PROP(identifier)
337
+ REMAP_MARKER_POINT_PROP(anchor)
338
+ REMAP_MARKER_POINT_PROP(calloutAnchor)
339
+ REMAP_MARKER_PROP(draggable)
340
+ REMAP_MARKER_PROP(tappable)
341
+ REMAP_MARKER_PROP(flat)
342
+ REMAP_MARKER_PROP(opacity)
343
+ REMAP_MARKER_PROP(tracksViewChanges)
344
+ REMAP_MARKER_PROP(tracksInfoWindowChanges)
345
+
346
+ [super updateProps:props oldProps:oldProps];
347
+ }
348
+
349
+ @end
350
+
351
+ Class<RCTComponentViewProtocol> RNMapsGoogleMarkerCls(void)
352
+ {
353
+ return RNMapsGoogleMarkerView.class;
354
+ }
355
+
356
+ #endif
357
+ #endif
@@ -0,0 +1,24 @@
1
+ //
2
+ // PlaceHolderGoogleMarkerView.h
3
+ // AirMaps
4
+ //
5
+ //
6
+ // Copyright © 2024 react-native-maps. All rights reserved.
7
+ //
8
+ #ifdef RCT_NEW_ARCH_ENABLED
9
+ #include "RNMapsDefines.h"
10
+
11
+ #if HAVE_GOOGLE_MAPS == 0
12
+
13
+ #import <React/RCTViewComponentView.h>
14
+ #import <UIKit/UIKit.h>
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+ @interface RNMapsGoogleMarkerView : RCTViewComponentView
18
+
19
+ @end
20
+
21
+ NS_ASSUME_NONNULL_END
22
+
23
+ #endif
24
+ #endif
@@ -0,0 +1,64 @@
1
+ //
2
+ // PlaceHolderGoogleMarkerView.mm
3
+ // AirMaps
4
+ //
5
+ //
6
+ // Copyright © 2024 react-native-maps. All rights reserved.
7
+ //
8
+ #ifdef RCT_NEW_ARCH_ENABLED
9
+ #include "RNMapsDefines.h"
10
+
11
+ #if HAVE_GOOGLE_MAPS == 0
12
+
13
+ #if __has_include(<ReactNativeMaps/generated/RNMapsAirModuleDelegate.h>)
14
+ #import <ReactNativeMaps/generated/RNMapsHostViewDelegate.h>
15
+ #import <ReactNativeMaps/generated/ComponentDescriptors.h>
16
+ #import <ReactNativeMaps/generated/EventEmitters.h>
17
+ #import <ReactNativeMaps/generated/Props.h>
18
+ #import <ReactNativeMaps/generated/RCTComponentViewHelpers.h>
19
+ #else
20
+ #import "../../generated/RNMapsSpecs/ComponentDescriptors.h"
21
+ #import "../../generated/RNMapsSpecs/EventEmitters.h"
22
+ #import "../../generated/RNMapsSpecs/Props.h"
23
+ #import "../../generated/RNMapsSpecs/RCTComponentViewHelpers.h"
24
+ #endif
25
+
26
+ #import "RCTFabricComponentsPlugins.h"
27
+ #import <React/RCTConversions.h>
28
+ #import "PlaceHolderGoogleMarkerView.h"
29
+
30
+ using namespace facebook::react;
31
+
32
+ @interface RNMapsGoogleMarkerView () <RCTRNMapsGoogleMarkerViewProtocol>
33
+ @end
34
+
35
+ @implementation RNMapsGoogleMarkerView
36
+
37
+ #pragma mark - Native commands (no-ops without Google Maps)
38
+
39
+ - (void)animateToCoordinates:(double)latitude longitude:(double)longitude duration:(NSInteger)duration {}
40
+ - (void)setCoordinates:(double)latitude longitude:(double)longitude {}
41
+ - (void)showCallout {}
42
+ - (void)hideCallout {}
43
+ - (void)redrawCallout {}
44
+ - (void)redraw {}
45
+
46
+ - (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
47
+ {
48
+ RCTRNMapsGoogleMarkerHandleCommand(self, commandName, args);
49
+ }
50
+
51
+ + (ComponentDescriptorProvider)componentDescriptorProvider
52
+ {
53
+ return concreteComponentDescriptorProvider<RNMapsGoogleMarkerComponentDescriptor>();
54
+ }
55
+
56
+ @end
57
+
58
+ Class<RCTComponentViewProtocol> RNMapsGoogleMarkerCls(void)
59
+ {
60
+ return RNMapsGoogleMarkerView.class;
61
+ }
62
+
63
+ #endif
64
+ #endif
@@ -9,8 +9,10 @@
9
9
  #import "RNMapsMapView.h"
10
10
  #import "AIRMap.h"
11
11
  #import "AIRMapMarker.h"
12
+ #import "AIRMapPolygon.h"
12
13
  #import "AIRMapManager.h"
13
14
  #import "RNMapsMarkerView.h"
15
+ #import "RNMapsPolygonView.h"
14
16
  #if __has_include(<ReactNativeMaps/generated/RNMapsAirModuleDelegate.h>)
15
17
  #import <ReactNativeMaps/generated/RNMapsAirModuleDelegate.h>
16
18
  #import <ReactNativeMaps/generated/RNMapsSpecs.h>
@@ -443,6 +445,9 @@ mapViewEventEmitter->emitterFunction(data); \
443
445
  } else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
444
446
  RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
445
447
  [_view insertReactSubview:[fabricMarker marker] atIndex:index];
448
+ } else if ([childComponentView isKindOfClass:[RNMapsPolygonView class]]){
449
+ RNMapsPolygonView* fabricPolygon = (RNMapsPolygonView *) childComponentView;
450
+ [_view insertReactSubview:[fabricPolygon polygon] atIndex:index];
446
451
  }
447
452
  else {
448
453
  [_view insertReactSubview:childComponentView atIndex:index];
@@ -458,6 +463,9 @@ mapViewEventEmitter->emitterFunction(data); \
458
463
  else if ([childComponentView isKindOfClass:[RNMapsMarkerView class]]){
459
464
  RNMapsMarkerView* fabricMarker = (RNMapsMarkerView *) childComponentView;
460
465
  [_view removeReactSubview:[fabricMarker marker]];
466
+ } else if ([childComponentView isKindOfClass:[RNMapsPolygonView class]]){
467
+ RNMapsPolygonView* fabricPolygon = (RNMapsPolygonView *) childComponentView;
468
+ [_view removeReactSubview:[fabricPolygon polygon]];
461
469
  } else {
462
470
  [_view removeReactSubview:childComponentView];
463
471
  }
@@ -0,0 +1,26 @@
1
+ //
2
+ // RNMapsPolygonView.h
3
+ // AirMaps
4
+ //
5
+ // Fabric component view for the Apple Maps polygon on iOS.
6
+ // Wraps the legacy `AIRMapPolygon` the same way `RNMapsGooglePolygonView`
7
+ // wraps the Google `AIRGMSPolygon`.
8
+ //
9
+ // Copyright © 2024 react-native-maps. All rights reserved.
10
+ //
11
+ #ifdef RCT_NEW_ARCH_ENABLED
12
+
13
+ #import <React/RCTViewComponentView.h>
14
+ #import <UIKit/UIKit.h>
15
+
16
+ NS_ASSUME_NONNULL_BEGIN
17
+
18
+ @class AIRMapPolygon;
19
+
20
+ @interface RNMapsPolygonView : RCTViewComponentView
21
+ - (AIRMapPolygon *)polygon;
22
+ @end
23
+
24
+ NS_ASSUME_NONNULL_END
25
+
26
+ #endif