react-native-maps 1.21.0-alpha.74 → 1.21.0-alpha.76

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 (45) hide show
  1. package/android/build.gradle +9 -3
  2. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +6 -0
  3. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +2 -0
  4. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +9 -9
  5. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +2 -2
  6. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +1 -0
  7. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1 -0
  8. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  9. package/android/gradlew +1 -2
  10. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +10 -0
  11. package/android/src/main/java/com/rnmaps/fabric/event/OnDoublePressEvent.java +27 -0
  12. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorBuildingFocusedEvent.java +28 -0
  13. package/android/src/main/java/com/rnmaps/fabric/event/OnIndoorLevelActivatedEvent.java +28 -0
  14. package/android/src/main/java/com/rnmaps/maps/MapView.java +25 -13
  15. package/ios/AirGoogleMaps/AIRGoogleMap.m +6 -6
  16. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +44 -1
  17. package/ios/AirMaps/RNMapsMapView.mm +6 -1
  18. package/ios/AirMaps/RNMapsMarkerView.mm +27 -27
  19. package/ios/generated/RCTAppDependencyProvider.h +0 -25
  20. package/ios/generated/RCTAppDependencyProvider.mm +0 -55
  21. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +0 -18
  22. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +0 -33
  23. package/ios/generated/RCTThirdPartyComponentsProvider.h +0 -16
  24. package/ios/generated/RCTThirdPartyComponentsProvider.mm +0 -26
  25. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +9 -9
  26. package/ios/generated/RNMapsSpecs/EventEmitters.h +2 -2
  27. package/ios/generated/RNMapsSpecs/Props.cpp +1 -0
  28. package/ios/generated/RNMapsSpecs/Props.h +1 -0
  29. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +42 -0
  30. package/lib/MapCircle.d.ts +1 -1
  31. package/lib/MapHeatmap.d.ts +2 -2
  32. package/lib/MapHeatmap.js +1 -1
  33. package/lib/MapMarker.d.ts +1 -1
  34. package/lib/MapPolygon.d.ts +1 -1
  35. package/lib/MapPolyline.d.ts +1 -1
  36. package/lib/MapView.d.ts +7 -5
  37. package/lib/MapView.js +16 -2
  38. package/lib/MapView.types.d.ts +1 -1
  39. package/lib/createFabricMap.d.ts +1 -0
  40. package/lib/createFabricMap.js +14 -1
  41. package/lib/specs/NativeComponentGoogleMapView.d.ts +3 -3
  42. package/lib/specs/NativeComponentGoogleMapView.js +1 -0
  43. package/lib/specs/NativeComponentMapView.d.ts +9 -0
  44. package/lib/specs/NativeComponentMapView.js +1 -0
  45. package/package.json +20 -20
@@ -7,7 +7,7 @@
7
7
  //
8
8
 
9
9
  #import "RNMapsMarkerView.h"
10
- #import "AirMap.h"
10
+ #import "AIRMap.h"
11
11
  #import "AIRMapMarker.h"
12
12
  #import "AIRMapMarkerManager.h"
13
13
  #import <react-native-maps-generated/ComponentDescriptors.h>
@@ -93,8 +93,8 @@ using namespace facebook::react;
93
93
  _props = defaultProps;
94
94
  _legacyMapManager = [[AIRMapMarkerManager alloc] init];
95
95
  _view = (AIRMapMarker *)[_legacyMapManager view];
96
-
97
-
96
+
97
+
98
98
  _view.onPress = [self](NSDictionary* dictionary) {
99
99
  if (_eventEmitter) {
100
100
  // Extract values from the NSDictionary
@@ -123,7 +123,7 @@ using namespace facebook::react;
123
123
  eventEmitter->onPress(data);
124
124
  }
125
125
  };
126
-
126
+
127
127
  _view.onDeselect = [self](NSDictionary* dictionary) {
128
128
  if (_eventEmitter) {
129
129
  // Extract values from the NSDictionary
@@ -152,7 +152,7 @@ using namespace facebook::react;
152
152
  eventEmitter->onDeselect(data);
153
153
  }
154
154
  };
155
-
155
+
156
156
  _view.onDrag = [self](NSDictionary* dictionary) {
157
157
  if (_eventEmitter) {
158
158
  // Extract values from the NSDictionary
@@ -190,7 +190,7 @@ using namespace facebook::react;
190
190
  eventEmitter->onDragStart(data);
191
191
  }
192
192
  };
193
-
193
+
194
194
  _view.onDragEnd = [self](NSDictionary* dictionary) {
195
195
  if (_eventEmitter) {
196
196
  // Extract values from the NSDictionary
@@ -210,7 +210,7 @@ using namespace facebook::react;
210
210
  eventEmitter->onDragEnd(data);
211
211
  }
212
212
  };
213
-
213
+
214
214
  _view.onSelect = [self](NSDictionary* dictionary) {
215
215
  if (_eventEmitter) {
216
216
  // Extract values from the NSDictionary
@@ -239,8 +239,8 @@ using namespace facebook::react;
239
239
  eventEmitter->onSelect(data);
240
240
  }
241
241
  };
242
-
243
-
242
+
243
+
244
244
  _view.onCalloutPress = [self](NSDictionary* dictionary) {
245
245
  if (_eventEmitter) {
246
246
  // Extract values from the NSDictionary
@@ -271,7 +271,7 @@ using namespace facebook::react;
271
271
  eventEmitter->onCalloutPress(data);
272
272
  }
273
273
  };
274
-
274
+
275
275
  }
276
276
 
277
277
  - (void)mountChildComponentView:(UIView<RCTComponentViewProtocol> *)childComponentView index:(NSInteger)index{
@@ -300,7 +300,7 @@ using namespace facebook::react;
300
300
  if (self = [super initWithFrame:frame]) {
301
301
  [self prepareMarkerView];
302
302
  }
303
-
303
+
304
304
  return self;
305
305
  }
306
306
 
@@ -310,28 +310,28 @@ using namespace facebook::react;
310
310
  const auto &oldViewProps = *std::static_pointer_cast<RNMapsMarkerProps const>(_props);
311
311
  const auto &newViewProps = *std::static_pointer_cast<RNMapsMarkerProps const>(props);
312
312
  BOOL completionHandlerCalled = false;
313
-
313
+
314
314
  #define REMAP_MAPVIEW_PROP(name) \
315
315
  if (oldViewProps.name != newViewProps.name) { \
316
316
  _view.name = newViewProps.name; \
317
317
  }
318
-
318
+
319
319
  #define REMAP_MAPVIEW_STRING_PROP(name) \
320
320
  if (oldViewProps.name != newViewProps.name) { \
321
321
  _view.name = RCTNSStringFromString(newViewProps.name); \
322
322
  }
323
-
323
+
324
324
  #define REMAP_MAPVIEW_COLOR_PROP(name) \
325
325
  if (oldViewProps.name != newViewProps.name) { \
326
326
  _view.name = RCTUIColorFromSharedColor(newViewProps.name); \
327
327
  }
328
-
328
+
329
329
  #define REMAP_MAPVIEW_POINT_PROP(name) \
330
330
  if (newViewProps.name.x != oldViewProps.name.x || \
331
331
  newViewProps.name.y != oldViewProps.name.y) { \
332
332
  _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
333
333
  }
334
-
334
+
335
335
  if (newViewProps.zIndex != oldViewProps.zIndex){
336
336
  if (newViewProps.zIndex.has_value()){
337
337
  _view.zIndex = newViewProps.zIndex.value();
@@ -348,17 +348,17 @@ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
348
348
  [_view setImageSrc:nil];
349
349
  }
350
350
  }
351
-
351
+
352
352
  REMAP_MAPVIEW_PROP(useLegacyPinView)
353
-
354
-
353
+
354
+
355
355
  REMAP_MAPVIEW_PROP(opacity)
356
356
  REMAP_MAPVIEW_PROP(draggable)
357
357
  REMAP_MAPVIEW_PROP(isPreselected)
358
-
358
+
359
359
  REMAP_MAPVIEW_COLOR_PROP(pinColor)
360
360
 
361
-
361
+
362
362
  REMAP_MAPVIEW_POINT_PROP(calloutOffset)
363
363
  if (newViewProps.coordinate.latitude != oldViewProps.coordinate.latitude ||
364
364
  newViewProps.coordinate.longitude != oldViewProps.coordinate.longitude) {
@@ -367,8 +367,8 @@ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
367
367
  newViewProps.coordinate.longitude);
368
368
  _view.coordinate = coordinates;
369
369
  }
370
-
371
-
370
+
371
+
372
372
  if (newViewProps.description != oldViewProps.description){
373
373
  _view.subtitle = RCTNSStringFromString(newViewProps.description);
374
374
  }
@@ -398,10 +398,10 @@ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
398
398
  case RNMapsMarkerSubtitleVisibility::Hidden:
399
399
  [_view setSubtitleVisibility:MKFeatureVisibilityHidden];
400
400
  break;
401
-
401
+
402
402
  }
403
403
  }
404
-
404
+
405
405
  if (newViewProps.displayPriority != oldViewProps.displayPriority){
406
406
  switch (newViewProps.displayPriority) {
407
407
  case RNMapsMarkerDisplayPriority::Required:
@@ -413,11 +413,11 @@ _view.name = CGPointMake(newViewProps.name.x, newViewProps.name.y); \
413
413
  case RNMapsMarkerDisplayPriority::Low:
414
414
  [_view setDisplayPriority:MKFeatureDisplayPriorityDefaultLow];
415
415
  break;
416
-
416
+
417
417
  }
418
418
  }
419
419
 
420
-
420
+
421
421
  [super updateProps:props oldProps:oldProps];
422
422
  }
423
423
 
@@ -1,25 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- #if __has_include(<React-RCTAppDelegate/RCTDependencyProvider.h>)
12
- #import <React-RCTAppDelegate/RCTDependencyProvider.h>
13
- #elif __has_include(<React_RCTAppDelegate/RCTDependencyProvider.h>)
14
- #import <React_RCTAppDelegate/RCTDependencyProvider.h>
15
- #else
16
- #import "RCTDependencyProvider.h"
17
- #endif
18
-
19
- NS_ASSUME_NONNULL_BEGIN
20
-
21
- @interface RCTAppDependencyProvider : NSObject <RCTDependencyProvider>
22
-
23
- @end
24
-
25
- NS_ASSUME_NONNULL_END
@@ -1,55 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import "RCTAppDependencyProvider.h"
9
- #import <ReactCodegen/RCTModulesConformingToProtocolsProvider.h>
10
- #import <ReactCodegen/RCTThirdPartyComponentsProvider.h>
11
-
12
- @implementation RCTAppDependencyProvider {
13
- NSArray<NSString *> * _URLRequestHandlerClassNames;
14
- NSArray<NSString *> * _imageDataDecoderClassNames;
15
- NSArray<NSString *> * _imageURLLoaderClassNames;
16
- NSDictionary<NSString *,Class<RCTComponentViewProtocol>> * _thirdPartyFabricComponents;
17
- }
18
-
19
- - (nonnull NSArray<NSString *> *)URLRequestHandlerClassNames {
20
- static dispatch_once_t requestUrlToken;
21
- dispatch_once(&requestUrlToken, ^{
22
- self->_URLRequestHandlerClassNames = RCTModulesConformingToProtocolsProvider.URLRequestHandlerClassNames;
23
- });
24
-
25
- return _URLRequestHandlerClassNames;
26
- }
27
-
28
- - (nonnull NSArray<NSString *> *)imageDataDecoderClassNames {
29
- static dispatch_once_t dataDecoderToken;
30
- dispatch_once(&dataDecoderToken, ^{
31
- _imageDataDecoderClassNames = RCTModulesConformingToProtocolsProvider.imageDataDecoderClassNames;
32
- });
33
-
34
- return _imageDataDecoderClassNames;
35
- }
36
-
37
- - (nonnull NSArray<NSString *> *)imageURLLoaderClassNames {
38
- static dispatch_once_t urlLoaderToken;
39
- dispatch_once(&urlLoaderToken, ^{
40
- _imageURLLoaderClassNames = RCTModulesConformingToProtocolsProvider.imageURLLoaderClassNames;
41
- });
42
-
43
- return _imageURLLoaderClassNames;
44
- }
45
-
46
- - (nonnull NSDictionary<NSString *,Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents {
47
- static dispatch_once_t nativeComponentsToken;
48
- dispatch_once(&nativeComponentsToken, ^{
49
- _thirdPartyFabricComponents = RCTThirdPartyComponentsProvider.thirdPartyFabricComponents;
50
- });
51
-
52
- return _thirdPartyFabricComponents;
53
- }
54
-
55
- @end
@@ -1,18 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- @interface RCTModulesConformingToProtocolsProvider: NSObject
11
-
12
- +(NSArray<NSString *> *)imageURLLoaderClassNames;
13
-
14
- +(NSArray<NSString *> *)imageDataDecoderClassNames;
15
-
16
- +(NSArray<NSString *> *)URLRequestHandlerClassNames;
17
-
18
- @end
@@ -1,33 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import "RCTModulesConformingToProtocolsProvider.h"
9
-
10
- @implementation RCTModulesConformingToProtocolsProvider
11
-
12
- +(NSArray<NSString *> *)imageURLLoaderClassNames
13
- {
14
- return @[
15
-
16
- ];
17
- }
18
-
19
- +(NSArray<NSString *> *)imageDataDecoderClassNames
20
- {
21
- return @[
22
-
23
- ];
24
- }
25
-
26
- +(NSArray<NSString *> *)URLRequestHandlerClassNames
27
- {
28
- return @[
29
-
30
- ];
31
- }
32
-
33
- @end
@@ -1,16 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
- #import <Foundation/Foundation.h>
9
-
10
- @protocol RCTComponentViewProtocol;
11
-
12
- @interface RCTThirdPartyComponentsProvider: NSObject
13
-
14
- + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents;
15
-
16
- @end
@@ -1,26 +0,0 @@
1
- /*
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- */
7
-
8
-
9
- #import <Foundation/Foundation.h>
10
-
11
- #import "RCTThirdPartyComponentsProvider.h"
12
- #import <React/RCTComponentViewProtocol.h>
13
-
14
- @implementation RCTThirdPartyComponentsProvider
15
-
16
- + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
17
- {
18
- return @{
19
- @"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
20
- @"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
21
- @"RNMapsMapView": NSClassFromString(@"RNMapsMapView"), // react-native-maps
22
- @"RNMapsMarker": NSClassFromString(@"RNMapsMarkerView"), // react-native-maps
23
- };
24
- }
25
-
26
- @end
@@ -39,10 +39,10 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFo
39
39
  dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
40
40
  auto $payload = jsi::Object(runtime);
41
41
  {
42
- auto IndoorBuilding = jsi::Object(runtime);
43
- IndoorBuilding.setProperty(runtime, "underground", $event.IndoorBuilding.underground);
44
- IndoorBuilding.setProperty(runtime, "activeLevelIndex", $event.IndoorBuilding.activeLevelIndex);
45
- $payload.setProperty(runtime, "IndoorBuilding", IndoorBuilding);
42
+ auto indoorBuilding = jsi::Object(runtime);
43
+ indoorBuilding.setProperty(runtime, "underground", $event.indoorBuilding.underground);
44
+ indoorBuilding.setProperty(runtime, "activeLevelIndex", $event.indoorBuilding.activeLevelIndex);
45
+ $payload.setProperty(runtime, "indoorBuilding", indoorBuilding);
46
46
  }
47
47
  return $payload;
48
48
  });
@@ -53,11 +53,11 @@ void RNMapsGoogleMapViewEventEmitter::onIndoorLevelActivated(OnIndoorLevelActiva
53
53
  dispatchEvent("indoorLevelActivated", [$event=std::move($event)](jsi::Runtime &runtime) {
54
54
  auto $payload = jsi::Object(runtime);
55
55
  {
56
- auto IndoorLevel = jsi::Object(runtime);
57
- IndoorLevel.setProperty(runtime, "activeLevelIndex", $event.IndoorLevel.activeLevelIndex);
58
- IndoorLevel.setProperty(runtime, "name", $event.IndoorLevel.name);
59
- IndoorLevel.setProperty(runtime, "shortName", $event.IndoorLevel.shortName);
60
- $payload.setProperty(runtime, "IndoorLevel", IndoorLevel);
56
+ auto indoorLevel = jsi::Object(runtime);
57
+ indoorLevel.setProperty(runtime, "activeLevelIndex", $event.indoorLevel.activeLevelIndex);
58
+ indoorLevel.setProperty(runtime, "name", $event.indoorLevel.name);
59
+ indoorLevel.setProperty(runtime, "shortName", $event.indoorLevel.shortName);
60
+ $payload.setProperty(runtime, "indoorLevel", indoorLevel);
61
61
  }
62
62
  return $payload;
63
63
  });
@@ -45,7 +45,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
45
45
  };
46
46
 
47
47
  struct OnIndoorBuildingFocused {
48
- OnIndoorBuildingFocusedIndoorBuilding IndoorBuilding;
48
+ OnIndoorBuildingFocusedIndoorBuilding indoorBuilding;
49
49
  };
50
50
 
51
51
  struct OnIndoorLevelActivatedIndoorLevel {
@@ -55,7 +55,7 @@ class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
55
55
  };
56
56
 
57
57
  struct OnIndoorLevelActivated {
58
- OnIndoorLevelActivatedIndoorLevel IndoorLevel;
58
+ OnIndoorLevelActivatedIndoorLevel indoorLevel;
59
59
  };
60
60
 
61
61
  struct OnKmlReady {
@@ -125,6 +125,7 @@ RNMapsMapViewProps::RNMapsMapViewProps(
125
125
  userLocationUpdateInterval(convertRawProp(context, rawProps, "userLocationUpdateInterval", sourceProps.userLocationUpdateInterval, {5000})),
126
126
  zoomControlEnabled(convertRawProp(context, rawProps, "zoomControlEnabled", sourceProps.zoomControlEnabled, {true})),
127
127
  zoomEnabled(convertRawProp(context, rawProps, "zoomEnabled", sourceProps.zoomEnabled, {true})),
128
+ showsTraffic(convertRawProp(context, rawProps, "showsTraffic", sourceProps.showsTraffic, {false})),
128
129
  zoomTapEnabled(convertRawProp(context, rawProps, "zoomTapEnabled", sourceProps.zoomTapEnabled, {true})),
129
130
  cameraZoomRange(convertRawProp(context, rawProps, "cameraZoomRange", sourceProps.cameraZoomRange, {}))
130
131
  {}
@@ -888,6 +888,7 @@ class RNMapsMapViewProps final : public ViewProps {
888
888
  int userLocationUpdateInterval{5000};
889
889
  bool zoomControlEnabled{true};
890
890
  bool zoomEnabled{true};
891
+ bool showsTraffic{false};
891
892
  bool zoomTapEnabled{true};
892
893
  RNMapsMapViewCameraZoomRangeStruct cameraZoomRange{};
893
894
  };
@@ -20,6 +20,7 @@ NS_ASSUME_NONNULL_BEGIN
20
20
  - (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated;
21
21
  - (void)fitToSuppliedMarkers:(NSString *)markersJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
22
22
  - (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
23
+ - (void)setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex;
23
24
  @end
24
25
 
25
26
  RCT_EXTERN inline void RCTRNMapsGoogleMapViewHandleCommand(
@@ -203,6 +204,26 @@ NSObject *arg2 = args[2];
203
204
  return;
204
205
  }
205
206
 
207
+ if ([commandName isEqualToString:@"setIndoorActiveLevelIndex"]) {
208
+ #if RCT_DEBUG
209
+ if ([args count] != 1) {
210
+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsGoogleMapView", commandName, (int)[args count], 1);
211
+ return;
212
+ }
213
+ #endif
214
+
215
+ NSObject *arg0 = args[0];
216
+ #if RCT_DEBUG
217
+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"RNMapsGoogleMapView", commandName, @"1st")) {
218
+ return;
219
+ }
220
+ #endif
221
+ NSInteger activeLevelIndex = [(NSNumber *)arg0 intValue];
222
+
223
+ [componentView setIndoorActiveLevelIndex:activeLevelIndex];
224
+ return;
225
+ }
226
+
206
227
  #if RCT_DEBUG
207
228
  RCTLogError(@"%@ received command %@, which is not a supported command.", @"RNMapsGoogleMapView", commandName);
208
229
  #endif
@@ -219,6 +240,7 @@ NSObject *arg2 = args[2];
219
240
  - (void)fitToElements:(NSString *)edgePaddingJSON animated:(BOOL)animated;
220
241
  - (void)fitToSuppliedMarkers:(NSString *)markersJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
221
242
  - (void)fitToCoordinates:(NSString *)coordinatesJSON edgePaddingJSON:(NSString *)edgePaddingJSON animated:(BOOL)animated;
243
+ - (void)setIndoorActiveLevelIndex:(NSInteger)activeLevelIndex;
222
244
  @end
223
245
 
224
246
  RCT_EXTERN inline void RCTRNMapsMapViewHandleCommand(
@@ -402,6 +424,26 @@ NSObject *arg2 = args[2];
402
424
  return;
403
425
  }
404
426
 
427
+ if ([commandName isEqualToString:@"setIndoorActiveLevelIndex"]) {
428
+ #if RCT_DEBUG
429
+ if ([args count] != 1) {
430
+ RCTLogError(@"%@ command %@ received %d arguments, expected %d.", @"RNMapsMapView", commandName, (int)[args count], 1);
431
+ return;
432
+ }
433
+ #endif
434
+
435
+ NSObject *arg0 = args[0];
436
+ #if RCT_DEBUG
437
+ if (!RCTValidateTypeOfViewCommandArgument(arg0, [NSNumber class], @"number", @"RNMapsMapView", commandName, @"1st")) {
438
+ return;
439
+ }
440
+ #endif
441
+ NSInteger activeLevelIndex = [(NSNumber *)arg0 intValue];
442
+
443
+ [componentView setIndoorActiveLevelIndex:activeLevelIndex];
444
+ return;
445
+ }
446
+
405
447
  #if RCT_DEBUG
406
448
  RCTLogError(@"%@ received command %@, which is not a supported command.", @"RNMapsMapView", commandName);
407
449
  #endif
@@ -101,7 +101,7 @@ export type MapCircleProps = ViewProps & {
101
101
  zIndex?: number;
102
102
  };
103
103
  type NativeProps = MapCircleProps & {
104
- ref: React.RefObject<View>;
104
+ ref: React.RefObject<View | null>;
105
105
  };
106
106
  export declare class MapCircle extends React.Component<MapCircleProps> {
107
107
  context: React.ContextType<typeof ProviderContext>;
@@ -59,9 +59,9 @@ type NativeProps = Modify<MapHeatmapProps, {
59
59
  colors: (ProcessedColorValue | null | undefined)[];
60
60
  }>;
61
61
  }> & {
62
- ref: React.RefObject<View>;
62
+ ref: React.RefObject<View | null>;
63
63
  };
64
- export declare class MapHeatmap extends React.Component<MapHeatmapProps> {
64
+ export declare class MapHeatmap extends React.Component<MapHeatmapProps | null> {
65
65
  context: React.ContextType<typeof ProviderContext>;
66
66
  getNativeComponent: () => NativeComponent<NativeProps>;
67
67
  getMapManagerCommand: (name: string) => MapManagerCommand;
package/lib/MapHeatmap.js CHANGED
@@ -41,7 +41,7 @@ class MapHeatmap extends React.Component {
41
41
  }
42
42
  render() {
43
43
  const AIRMapHeatmap = this.getNativeComponent();
44
- const propGradient = this.props.gradient;
44
+ const propGradient = this.props?.gradient;
45
45
  let gradient;
46
46
  if (propGradient) {
47
47
  const colors = propGradient.colors.map(c => (0, react_native_1.processColor)(c));
@@ -298,7 +298,7 @@ export type NativeProps = Modify<OmittedProps, {
298
298
  icon?: string;
299
299
  image?: MapMarkerProps['image'] | string;
300
300
  }> & {
301
- ref: React.RefObject<MapMarkerNativeComponentType>;
301
+ ref: React.RefObject<MapMarkerNativeComponentType | null>;
302
302
  };
303
303
  export declare class MapMarker extends React.Component<MapMarkerProps> {
304
304
  context: React.ContextType<typeof ProviderContext>;
@@ -124,7 +124,7 @@ export type MapPolygonProps = ViewProps & {
124
124
  zIndex?: number;
125
125
  };
126
126
  type NativeProps = MapPolygonProps & {
127
- ref: React.RefObject<View>;
127
+ ref: React.RefObject<View | null>;
128
128
  };
129
129
  export declare class MapPolygon extends React.Component<MapPolygonProps> {
130
130
  context: React.ContextType<typeof ProviderContext>;
@@ -125,7 +125,7 @@ export type MapPolylineProps = ViewProps & {
125
125
  zIndex?: number;
126
126
  };
127
127
  type NativeProps = MapPolylineProps & {
128
- ref: React.RefObject<View>;
128
+ ref: React.RefObject<View | null>;
129
129
  };
130
130
  export declare class MapPolyline extends React.Component<MapPolylineProps> {
131
131
  context: React.ContextType<typeof ProviderContext>;
package/lib/MapView.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import { Animated as RNAnimated, Animated, NativeSyntheticEvent, ViewProps } from 'react-native';
3
3
  import { CalloutPressEvent, ClickEvent, Frame, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Point, Provider, Region } from './sharedTypes';
4
- import { Address, BoundingBox, Camera, CameraZoomRange, ChangeEvent, Details, EdgePadding, FitToOptions, IndoorBuildingEvent, IndoorLevelActivatedEvent, KmlMapEvent, LongPressEvent, MapPressEvent, MapStyleElement, MapType, MapTypes, PanDragEvent, PoiClickEvent, SnapshotOptions, UserLocationChangeEvent } from './MapView.types';
4
+ import { ActiveIndoorLevel, Address, BoundingBox, Camera, CameraZoomRange, ChangeEvent, Details, EdgePadding, FitToOptions, IndoorBuilding, KmlMapEvent, LongPressEvent, MapPressEvent, MapStyleElement, MapType, MapTypes, PanDragEvent, PoiClickEvent, SnapshotOptions, UserLocationChangeEvent } from './MapView.types';
5
5
  import { Modify } from './sharedTypesInternal';
6
6
  import { MapViewNativeComponentType } from './MapViewNativeComponent';
7
7
  import AnimatedRegion from './AnimatedRegion';
@@ -217,14 +217,14 @@ export type MapViewProps = ViewProps & {
217
217
  * @platform iOS: Google Maps only
218
218
  * @platform Android: Supported
219
219
  */
220
- onIndoorBuildingFocused?: (event: IndoorBuildingEvent) => void;
220
+ onIndoorBuildingFocused?: (indoorBuilding: IndoorBuilding) => void;
221
221
  /**
222
222
  * Callback that is called when a level on indoor building is activated
223
223
  *
224
224
  * @platform iOS: Google Maps only
225
225
  * @platform Android: Supported
226
226
  */
227
- onIndoorLevelActivated?: (event: IndoorLevelActivatedEvent) => void;
227
+ onIndoorLevelActivated?: (indoorLevel: ActiveIndoorLevel) => void;
228
228
  /**
229
229
  * Callback that is called once the kml is fully loaded.
230
230
  *
@@ -586,7 +586,7 @@ type ModifiedProps = Modify<MapViewProps, {
586
586
  initialRegion?: MapViewProps['initialRegion'] | null;
587
587
  }>;
588
588
  export type NativeProps = Omit<ModifiedProps, 'customMapStyle' | 'onRegionChange' | 'onRegionChangeComplete'> & {
589
- ref: React.RefObject<MapViewNativeComponentType>;
589
+ ref: React.RefObject<MapViewNativeComponentType | null>;
590
590
  customMapStyleString?: string;
591
591
  handlePanDrag?: boolean;
592
592
  onChange?: (e: ChangeEvent) => void;
@@ -619,7 +619,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
619
619
  */
620
620
  getMapBoundaries(): Promise<BoundingBox>;
621
621
  setMapBoundaries(northEast: LatLng, southWest: LatLng): void;
622
- setIndoorActiveLevelIndex(activeLevelIndex: number): void;
622
+ setIndoorActiveLevelIndex(activeLevelIndex: number): void | Promise<never>;
623
623
  /**
624
624
  * Takes a snapshot of the map and saves it to a picture
625
625
  * file or returns the image as a base64 encoded string.
@@ -693,6 +693,8 @@ declare class MapView extends React.Component<MapViewProps, State> {
693
693
  private handleMarkerDeselect;
694
694
  private handleRegionChange;
695
695
  private handleRegionChangeStarted;
696
+ private handleIndoorBuildingFocused;
697
+ private handleIndoorLevelActivated;
696
698
  private handleRegionChangeComplete;
697
699
  render(): React.JSX.Element;
698
700
  }
package/lib/MapView.js CHANGED
@@ -167,9 +167,10 @@ class MapView extends React.Component {
167
167
  }
168
168
  }
169
169
  setIndoorActiveLevelIndex(activeLevelIndex) {
170
- if (this.map.current) {
171
- MapViewNativeComponent_1.Commands.setIndoorActiveLevelIndex(this.map.current, activeLevelIndex);
170
+ if (this.fabricMap.current) {
171
+ return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
172
172
  }
173
+ return Promise.reject('getMapBoundaries not supported on this platform');
173
174
  }
174
175
  /**
175
176
  * Takes a snapshot of the map and saves it to a picture
@@ -340,6 +341,16 @@ class MapView extends React.Component {
340
341
  this.props.onRegionChangeStart(event);
341
342
  }
342
343
  };
344
+ handleIndoorBuildingFocused = (event) => {
345
+ if (this.props.onIndoorBuildingFocused) {
346
+ this.props.onIndoorBuildingFocused(event);
347
+ }
348
+ };
349
+ handleIndoorLevelActivated = (event) => {
350
+ if (this.props.onIndoorLevelActivated) {
351
+ this.props.onIndoorLevelActivated(event);
352
+ }
353
+ };
343
354
  handleRegionChangeComplete = (event) => {
344
355
  const isGesture = event.nativeEvent.isGesture;
345
356
  const details = { isGesture };
@@ -368,6 +379,9 @@ class MapView extends React.Component {
368
379
  onRegionChange: this.handleRegionChange,
369
380
  onRegionChangeStart: this.handleRegionChangeStarted,
370
381
  onRegionChangeComplete: this.handleRegionChangeComplete,
382
+ onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
383
+ // @ts-ignore
384
+ onIndoorLevelActivated: this.handleIndoorLevelActivated,
371
385
  ...restProps,
372
386
  };
373
387
  if (this.props.region) {
@@ -46,7 +46,7 @@ export type ActiveIndoorLevel = {
46
46
  shortName: string;
47
47
  };
48
48
  export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
49
- IndoorLevel: ActiveIndoorLevel;
49
+ indoorLevel: ActiveIndoorLevel;
50
50
  }>;
51
51
  export type IndoorBuilding = {
52
52
  underground: boolean;
@@ -18,6 +18,7 @@ export interface FabricMapHandle {
18
18
  getAddressFromCoordinates: (coordinate: LatLng) => Promise<Address>;
19
19
  getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
20
20
  getCoordinateForPoint: (point: Point) => Promise<LatLng>;
21
+ setIndoorActiveLevelIndex: (activeLevelIndex: number) => void;
21
22
  }
22
23
  declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
23
24
  export default createFabricMap;