react-native-maps 1.21.0-alpha.7 → 1.21.0-alpha.71

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 (148) hide show
  1. package/android/build.gradle +38 -13
  2. package/android/generated/RCTAppDependencyProvider.h +25 -0
  3. package/android/generated/RCTAppDependencyProvider.mm +55 -0
  4. package/android/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  5. package/android/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  6. package/android/generated/RCTThirdPartyComponentsProvider.h +16 -0
  7. package/android/generated/RCTThirdPartyComponentsProvider.mm +26 -0
  8. package/android/generated/ReactAppDependencyProvider.podspec +34 -0
  9. package/android/generated/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
  10. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
  11. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
  12. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +200 -0
  13. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +71 -0
  14. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
  15. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
  16. package/android/generated/jni/CMakeLists.txt +36 -0
  17. package/android/generated/jni/RNMapsSpecs-generated.cpp +68 -0
  18. package/android/generated/jni/RNMapsSpecs.h +31 -0
  19. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +26 -0
  20. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +28 -0
  21. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +918 -0
  22. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +787 -0
  23. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +154 -0
  24. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +1058 -0
  25. package/android/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
  26. package/android/generated/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
  27. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +21 -0
  28. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +76 -0
  29. package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
  30. package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +77 -0
  31. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  32. package/android/src/main/java/com/rnmaps/fabric/CalloutManager.java +77 -0
  33. package/android/src/main/java/com/rnmaps/fabric/JSONUtil.java +86 -0
  34. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +593 -0
  35. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +259 -0
  36. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +156 -4
  37. package/android/src/main/java/com/rnmaps/fabric/event/OnCalloutPressEvent.java +25 -0
  38. package/android/src/main/java/com/rnmaps/fabric/event/OnDeselectEvent.java +28 -0
  39. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEndEvent.java +28 -0
  40. package/android/src/main/java/com/rnmaps/fabric/event/OnDragEvent.java +28 -0
  41. package/android/src/main/java/com/rnmaps/fabric/event/OnDragStartEvent.java +28 -0
  42. package/android/src/main/java/com/rnmaps/fabric/event/OnLongPressEvent.java +28 -0
  43. package/android/src/main/java/com/rnmaps/fabric/event/OnMapLoadedEvent.java +29 -0
  44. package/android/src/main/java/com/rnmaps/fabric/event/OnMapReadyEvent.java +29 -0
  45. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDeselectEvent.java +28 -0
  46. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEndEvent.java +28 -0
  47. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragEvent.java +28 -0
  48. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerDragStartEvent.java +28 -0
  49. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerPressEvent.java +28 -0
  50. package/android/src/main/java/com/rnmaps/fabric/event/OnMarkerSelectEvent.java +28 -0
  51. package/android/src/main/java/com/rnmaps/fabric/event/OnPoiClickEvent.java +27 -0
  52. package/android/src/main/java/com/rnmaps/fabric/event/OnPressEvent.java +27 -0
  53. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeCompleteEvent.java +30 -0
  54. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +48 -0
  55. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeStartEvent.java +33 -0
  56. package/android/src/main/java/com/rnmaps/fabric/event/OnSelectEvent.java +28 -0
  57. package/android/src/main/java/com/rnmaps/fabric/event/OnUserLocationChangeEvent.java +28 -0
  58. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +22 -2
  59. package/android/src/main/java/com/rnmaps/maps/MapCallout.java +18 -0
  60. package/android/src/main/java/com/rnmaps/maps/MapManager.java +14 -14
  61. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +79 -3
  62. package/android/src/main/java/com/rnmaps/maps/MapModule.java +206 -206
  63. package/android/src/main/java/com/rnmaps/maps/MapView.java +1618 -1346
  64. package/ios/AirGoogleMaps/AIRGoogleMap.h +3 -2
  65. package/ios/AirGoogleMaps/AIRGoogleMap.m +153 -48
  66. package/ios/AirGoogleMaps/AIRGoogleMapCircle.m +23 -11
  67. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +17 -28
  68. package/ios/AirGoogleMaps/AIRGoogleMapMarker.h +2 -0
  69. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +347 -243
  70. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.h +2 -1
  71. package/ios/AirGoogleMaps/AIRGoogleMapPolygon.m +30 -0
  72. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.h +0 -1
  73. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +0 -7
  74. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.h +1 -1
  75. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
  76. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.h +3 -0
  77. package/ios/AirGoogleMaps/RCTConvert+GMSMapViewType.m +2 -0
  78. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +3 -3
  79. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +161 -61
  80. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.h +26 -0
  81. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +217 -0
  82. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +25 -0
  83. package/ios/AirMaps/AIRMap.h +6 -3
  84. package/ios/AirMaps/AIRMap.m +289 -145
  85. package/ios/AirMaps/AIRMapManager.m +8 -17
  86. package/ios/AirMaps/AIRMapMarker.h +1 -0
  87. package/ios/AirMaps/AIRMapMarker.m +165 -103
  88. package/ios/AirMaps/Callout/SMCalloutView.m +1 -1
  89. package/ios/AirMaps/RCTConvert+AirMap.h +4 -0
  90. package/ios/AirMaps/RCTConvert+AirMap.m +2 -0
  91. package/ios/AirMaps/RNMapsAirModule.h +1 -1
  92. package/ios/AirMaps/RNMapsAirModule.mm +42 -172
  93. package/ios/AirMaps/RNMapsAirModuleDelegate.h +24 -0
  94. package/ios/AirMaps/RNMapsHostVewDelegate.h +17 -0
  95. package/ios/AirMaps/RNMapsMapView.h +3 -3
  96. package/ios/AirMaps/RNMapsMapView.mm +344 -307
  97. package/ios/AirMaps/RNMapsMarkerView.h +24 -0
  98. package/ios/AirMaps/RNMapsMarkerView.mm +430 -0
  99. package/ios/AirMaps/RNMapsMarkerViewManager.mm +21 -0
  100. package/ios/AirMaps/UIView +AirMap.m +20 -0
  101. package/ios/AirMaps/UIView+AirMap.h +11 -0
  102. package/ios/AirMaps.xcodeproj/project.pbxproj +60 -0
  103. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  104. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  105. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  106. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  107. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  108. package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
  109. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +26 -0
  110. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +28 -0
  111. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +918 -0
  112. package/ios/generated/RNMapsSpecs/EventEmitters.h +787 -0
  113. package/ios/generated/RNMapsSpecs/Props.cpp +154 -0
  114. package/ios/generated/RNMapsSpecs/Props.h +1058 -0
  115. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +549 -0
  116. package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
  117. package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
  118. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +21 -0
  119. package/ios/generated/RNMapsSpecs/ShadowNodes.h +76 -0
  120. package/ios/generated/RNMapsSpecs/States.cpp +16 -0
  121. package/ios/generated/RNMapsSpecs/States.h +77 -0
  122. package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
  123. package/ios/generated/RNMapsSpecsJSI.h +268 -0
  124. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  125. package/lib/MapCallout.js +1 -0
  126. package/lib/MapMarker.d.ts +15 -2
  127. package/lib/MapMarker.js +53 -9
  128. package/lib/MapMarkerNativeComponent.js +0 -2
  129. package/lib/MapOverlay.js +2 -8
  130. package/lib/MapPolyline.d.ts +1 -1
  131. package/lib/MapView.d.ts +7 -22
  132. package/lib/MapView.js +83 -94
  133. package/lib/{FabricMapView.d.ts → createFabricMap.d.ts} +7 -11
  134. package/lib/createFabricMap.js +175 -0
  135. package/lib/decorateMapComponent.js +22 -0
  136. package/lib/specs/NativeAirMapsModule.d.ts +2 -2
  137. package/lib/specs/NativeComponentCallout.d.ts +46 -0
  138. package/lib/specs/NativeComponentCallout.js +9 -0
  139. package/lib/specs/NativeComponentGoogleMapView.d.ts +12 -12
  140. package/lib/specs/NativeComponentGooglePolygon.d.ts +75 -0
  141. package/lib/specs/NativeComponentGooglePolygon.js +9 -0
  142. package/lib/specs/NativeComponentMapView.d.ts +19 -36
  143. package/lib/specs/NativeComponentMapView.js +1 -3
  144. package/lib/specs/NativeComponentMarker.d.ts +258 -0
  145. package/lib/specs/NativeComponentMarker.js +19 -0
  146. package/package.json +15 -10
  147. package/react-native-maps.podspec +2 -1
  148. package/lib/FabricMapView.js +0 -181
@@ -0,0 +1,34 @@
1
+ # Copyright (c) Meta Platforms, Inc. and affiliates.
2
+ #
3
+ # This source code is licensed under the MIT license found in the
4
+ # LICENSE file in the root directory of this source tree.
5
+
6
+ version = "0.77.1"
7
+ source = { :git => 'https://github.com/facebook/react-native.git' }
8
+ if version == '1000.0.0'
9
+ # This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
10
+ source[:commit] = `git rev-parse HEAD`.strip if system("git rev-parse --git-dir > /dev/null 2>&1")
11
+ else
12
+ source[:tag] = "v#{version}"
13
+ end
14
+
15
+ Pod::Spec.new do |s|
16
+ s.name = "ReactAppDependencyProvider"
17
+ s.version = version
18
+ s.summary = "The third party dependency provider for the app"
19
+ s.homepage = "https://reactnative.dev/"
20
+ s.documentation_url = "https://reactnative.dev/"
21
+ s.license = "MIT"
22
+ s.author = "Meta Platforms, Inc. and its affiliates"
23
+ s.platforms = min_supported_versions
24
+ s.source = source
25
+ s.source_files = "**/RCTAppDependencyProvider.{h,mm}"
26
+
27
+ # This guard prevent to install the dependencies when we run `pod install` in the old architecture.
28
+ s.pod_target_xcconfig = {
29
+ "CLANG_CXX_LANGUAGE_STANDARD" => rct_cxx_language_standard(),
30
+ "DEFINES_MODULE" => "YES"
31
+ }
32
+
33
+ s.dependency "ReactCodegen"
34
+ end
package/lib/MapCallout.js CHANGED
@@ -34,6 +34,7 @@ class MapCallout extends React.Component {
34
34
  render() {
35
35
  const { tooltip = false, alphaHitTest = false } = this.props;
36
36
  const AIRMapCallout = this.getNativeComponent();
37
+ console.log('renderCallout ' + AIRMapCallout);
37
38
  return (<AIRMapCallout {...this.props} tooltip={tooltip} alphaHitTest={alphaHitTest} style={[styles.callout, this.props.style]}/>);
38
39
  }
39
40
  }
@@ -2,6 +2,7 @@ import * as React from 'react';
2
2
  import { Animated, ViewProps, ImageURISource, ImageRequireSource } from 'react-native';
3
3
  import { MapManagerCommand, NativeComponent, ProviderContext, UIManagerCommand } from './decorateMapComponent';
4
4
  import { MapMarkerNativeComponentType } from './MapMarkerNativeComponent';
5
+ import type { AppleMarkerPriority } from './specs/NativeComponentMarker';
5
6
  import { CalloutPressEvent, LatLng, MarkerDeselectEvent, MarkerDragEvent, MarkerDragStartEndEvent, MarkerPressEvent, MarkerSelectEvent, Point } from './sharedTypes';
6
7
  import { Modify } from './sharedTypesInternal';
7
8
  type AppleMarkerVisibility = 'hidden' | 'adaptive' | 'visible';
@@ -42,7 +43,7 @@ export type MapMarkerProps = ViewProps & {
42
43
  *
43
44
  * @default {x: 0.0, y: 0.0}
44
45
  * @platform iOS: Apple Maps only. For Google Maps, see the `calloutAnchor` prop
45
- * @platform Android: Not supported. See see the `calloutAnchor` prop
46
+ * @platform Android: Not supported. see the `calloutAnchor` prop
46
47
  */
47
48
  calloutOffset?: Point;
48
49
  /**
@@ -54,7 +55,7 @@ export type MapMarkerProps = ViewProps & {
54
55
  *
55
56
  * @default {x: 0.0, y: 0.0}
56
57
  * @platform iOS: Apple Maps only. For Google Maps, see the `anchor` prop
57
- * @platform Android: Not supported. See see the `anchor` prop
58
+ * @platform Android: Not supported. see the `anchor` prop
58
59
  */
59
60
  centerOffset?: Point;
60
61
  /**
@@ -261,6 +262,17 @@ export type MapMarkerProps = ViewProps & {
261
262
  * @platform Android: Supported
262
263
  */
263
264
  zIndex?: number;
265
+ /**
266
+ Constants that indicates the display priority for annotations.
267
+ @default required
268
+ @platform iOS: Apple Maps only.
269
+ @platform Android: Not supported
270
+
271
+ Required: A constant indicating that the item is required.
272
+ High: A constant indicating that the item’s display priority is high.
273
+ Low: A constant indicating that the item’s display priority is Low.
274
+ */
275
+ displayPriority?: AppleMarkerPriority;
264
276
  /**
265
277
  * Visibility of the title text rendered beneath Marker balloon
266
278
  * @platform iOS: Apple Maps only
@@ -295,6 +307,7 @@ export declare class MapMarker extends React.Component<MapMarkerProps> {
295
307
  getUIManagerCommand: (name: string) => UIManagerCommand;
296
308
  static Animated: Animated.AnimatedComponent<typeof MapMarker>;
297
309
  private marker;
310
+ private fabricMarker?;
298
311
  constructor(props: MapMarkerProps);
299
312
  setNativeProps(props: Partial<NativeProps>): void;
300
313
  showCallout(): void;
package/lib/MapMarker.js CHANGED
@@ -28,12 +28,15 @@ const React = __importStar(require("react"));
28
28
  const react_native_1 = require("react-native");
29
29
  const decorateMapComponent_1 = __importStar(require("./decorateMapComponent"));
30
30
  const MapMarkerNativeComponent_1 = require("./MapMarkerNativeComponent");
31
+ const NativeComponentMarker_1 = require("./specs/NativeComponentMarker");
32
+ const ProviderConstants_1 = require("./ProviderConstants");
31
33
  class MapMarker extends React.Component {
32
34
  getNativeComponent;
33
35
  getMapManagerCommand;
34
36
  getUIManagerCommand;
35
37
  static Animated;
36
38
  marker;
39
+ fabricMarker = undefined;
37
40
  constructor(props) {
38
41
  super(props);
39
42
  this.marker = React.createRef();
@@ -49,27 +52,59 @@ class MapMarker extends React.Component {
49
52
  }
50
53
  showCallout() {
51
54
  if (this.marker.current) {
52
- MapMarkerNativeComponent_1.Commands.showCallout(this.marker.current);
55
+ if (this.fabricMarker) {
56
+ // @ts-ignore
57
+ NativeComponentMarker_1.Commands.showCallout(this.marker.current);
58
+ }
59
+ else {
60
+ MapMarkerNativeComponent_1.Commands.showCallout(this.marker.current);
61
+ }
53
62
  }
54
63
  }
55
64
  hideCallout() {
56
65
  if (this.marker.current) {
57
- MapMarkerNativeComponent_1.Commands.hideCallout(this.marker.current);
66
+ if (this.fabricMarker) {
67
+ // @ts-ignore
68
+ NativeComponentMarker_1.Commands.hideCallout(this.marker.current);
69
+ }
70
+ else {
71
+ MapMarkerNativeComponent_1.Commands.hideCallout(this.marker.current);
72
+ }
58
73
  }
59
74
  }
60
75
  setCoordinates(coordinate) {
61
76
  if (this.marker.current) {
62
- MapMarkerNativeComponent_1.Commands.setCoordinates(this.marker.current, coordinate);
77
+ if (this.fabricMarker) {
78
+ NativeComponentMarker_1.Commands.setCoordinates(
79
+ // @ts-ignore
80
+ this.marker.current, coordinate.latitude, coordinate.longitude);
81
+ }
82
+ else {
83
+ MapMarkerNativeComponent_1.Commands.setCoordinates(this.marker.current, coordinate);
84
+ }
63
85
  }
64
86
  }
65
87
  redrawCallout() {
66
88
  if (this.marker.current) {
67
- MapMarkerNativeComponent_1.Commands.redrawCallout(this.marker.current);
89
+ if (this.fabricMarker) {
90
+ // @ts-ignore
91
+ NativeComponentMarker_1.Commands.redrawCallout(this.marker.current);
92
+ }
93
+ else {
94
+ MapMarkerNativeComponent_1.Commands.redrawCallout(this.marker.current);
95
+ }
68
96
  }
69
97
  }
70
98
  animateMarkerToCoordinate(coordinate, duration = 500) {
71
99
  if (this.marker.current) {
72
- MapMarkerNativeComponent_1.Commands.animateMarkerToCoordinate(this.marker.current, coordinate, duration);
100
+ if (this.fabricMarker) {
101
+ NativeComponentMarker_1.Commands.animateToCoordinates(
102
+ // @ts-ignore
103
+ this.marker.current, coordinate.latitude, coordinate.longitude, duration);
104
+ }
105
+ else {
106
+ MapMarkerNativeComponent_1.Commands.animateMarkerToCoordinate(this.marker.current, coordinate, duration);
107
+ }
73
108
  }
74
109
  }
75
110
  redraw() {
@@ -79,10 +114,9 @@ class MapMarker extends React.Component {
79
114
  }
80
115
  render() {
81
116
  const { stopPropagation = false } = this.props;
82
- let image;
83
- if (this.props.image) {
84
- image = react_native_1.Image.resolveAssetSource(this.props.image) || {};
85
- image = image.uri || this.props.image;
117
+ if (this.fabricMarker === undefined) {
118
+ const provider = this.context;
119
+ this.fabricMarker = !(react_native_1.Platform.OS === 'ios' && provider !== ProviderConstants_1.PROVIDER_GOOGLE);
86
120
  }
87
121
  let icon;
88
122
  if (this.props.icon) {
@@ -90,6 +124,16 @@ class MapMarker extends React.Component {
90
124
  icon = icon.uri;
91
125
  }
92
126
  const AIRMapMarker = this.getNativeComponent();
127
+ let image;
128
+ if (this.props.image) {
129
+ if (this.fabricMarker) {
130
+ image = this.props.image;
131
+ }
132
+ else {
133
+ const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
134
+ image = resolvedImage.uri || this.props.image;
135
+ }
136
+ }
93
137
  return (<AIRMapMarker {...this.props} ref={this.marker} image={image} icon={icon} style={[styles.marker, this.props.style]} onPress={event => {
94
138
  if (stopPropagation) {
95
139
  event.stopPropagation();
@@ -9,9 +9,7 @@ exports.Commands = (0, codegenNativeCommands_1.default)({
9
9
  supportedCommands: [
10
10
  'showCallout',
11
11
  'hideCallout',
12
- 'redrawCallout',
13
12
  'animateMarkerToCoordinate',
14
- 'redraw',
15
13
  'setCoordinates',
16
14
  ],
17
15
  });
package/lib/MapOverlay.js CHANGED
@@ -35,14 +35,8 @@ class MapOverlay extends React.Component {
35
35
  render() {
36
36
  const { opacity = 1.0 } = this.props;
37
37
  let image;
38
- if (typeof this.props.image !== 'number' &&
39
- this.props.image.uri?.startsWith('http')) {
40
- image = this.props.image.uri;
41
- }
42
- else {
43
- const sourceAsset = react_native_1.Image.resolveAssetSource(this.props.image) || {};
44
- image = sourceAsset.uri;
45
- }
38
+ const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
39
+ image = resolvedImage.uri || this.props.image;
46
40
  const AIRMapOverlay = this.getNativeComponent();
47
41
  return (<AIRMapOverlay {...this.props} opacity={opacity} image={image} style={[styles.overlay, this.props.style]}/>);
48
42
  }
@@ -14,7 +14,7 @@ export type MapPolylineProps = ViewProps & {
14
14
  * The fill color to use for the path.
15
15
  *
16
16
  * @default `#000`, `rgba(r,g,b,0.5)`
17
- * @platform iOS: Supported
17
+ * @platform iOS: Apple Maps only
18
18
  * @platform Android: Not supported
19
19
  */
20
20
  fillColor?: string;
package/lib/MapView.d.ts CHANGED
@@ -426,7 +426,7 @@ export type MapViewProps = ViewProps & {
426
426
  * If `false` compass won't be displayed on the map.
427
427
  *
428
428
  * @default true
429
- * @platform iOS: Supported
429
+ * @platform iOS: Supported (adaptive on Apple Maps, visible only if map is not pointing north)
430
430
  * @platform Android: Supported
431
431
  */
432
432
  showsCompass?: boolean;
@@ -454,32 +454,14 @@ export type MapViewProps = ViewProps & {
454
454
  * @platform Android: Supported
455
455
  */
456
456
  showsMyLocationButton?: boolean;
457
- /**
458
- * If `false` points of interest won't be displayed on the map.
459
- * TODO: DEPRECATED? Doesn't seem to do anything
460
- *
461
- * @default true
462
- * @platform iOS: Maybe Apple Maps?
463
- * @platform Android: Not supported
464
- */
465
- showsPointsOfInterest?: boolean;
466
457
  /**
467
458
  * A Boolean indicating whether the map shows scale information.
468
459
  *
469
- * @default true
460
+ * @default false
470
461
  * @platform iOS: Apple Maps only
471
462
  * @platform Android: Not supported
472
463
  */
473
464
  showsScale?: boolean;
474
- /**
475
- * A Boolean value indicating whether the map displays traffic information.
476
- * TODO: Look into android support
477
- *
478
- * @default false
479
- * @platform iOS: Supported
480
- * @platform Android: Not supported?
481
- */
482
- showsTraffic?: boolean;
483
465
  /**
484
466
  * If `true` the users location will be displayed on the map.
485
467
  *
@@ -510,8 +492,8 @@ export type MapViewProps = ViewProps & {
510
492
  * Sets the map to the style selected.
511
493
  *
512
494
  * @default System setting
513
- * @platform iOS: Apple Maps only (iOS >= 13.0)
514
- * @platform Android: Not supported
495
+ * @platform iOS: Supported
496
+ * @platform Android: Supported
515
497
  */
516
498
  userInterfaceStyle?: 'light' | 'dark';
517
499
  /**
@@ -626,6 +608,7 @@ declare class MapView extends React.Component<MapViewProps, State> {
626
608
  duration?: number;
627
609
  }): void;
628
610
  animateToRegion(region: Region, duration?: number): void;
611
+ setRegion(region: Region): void;
629
612
  fitToElements(options?: FitToOptions): void;
630
613
  fitToSuppliedMarkers(markers: string[], options?: FitToOptions): void;
631
614
  fitToCoordinates(coordinates?: LatLng[], options?: FitToOptions): void;
@@ -709,6 +692,8 @@ declare class MapView extends React.Component<MapViewProps, State> {
709
692
  private handleMarkerSelect;
710
693
  private handleMarkerDeselect;
711
694
  private handleRegionChange;
695
+ private handleRegionChangeStarted;
696
+ private handleRegionChangeComplete;
712
697
  render(): React.JSX.Element;
713
698
  }
714
699
  export declare const AnimatedMapView: RNAnimated.AnimatedComponent<typeof MapView>;
package/lib/MapView.js CHANGED
@@ -31,7 +31,14 @@ const React = __importStar(require("react"));
31
31
  const react_native_1 = require("react-native");
32
32
  const decorateMapComponent_1 = require("./decorateMapComponent");
33
33
  const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
34
- const FabricMapView_1 = __importDefault(require("./FabricMapView"));
34
+ const NativeComponentMapView_1 = __importStar(require("./specs/NativeComponentMapView"));
35
+ const NativeComponentGoogleMapView_1 = __importStar(require("./specs/NativeComponentGoogleMapView"));
36
+ const createFabricMap_1 = __importDefault(require("./createFabricMap"));
37
+ const FabricMap = (0, createFabricMap_1.default)(NativeComponentMapView_1.default, NativeComponentMapView_1.Commands);
38
+ var FabricGoogleMap = null;
39
+ if (react_native_1.Platform.OS === 'ios') {
40
+ FabricGoogleMap = (0, createFabricMap_1.default)(NativeComponentGoogleMapView_1.default, NativeComponentGoogleMapView_1.Commands);
41
+ }
35
42
  exports.MAP_TYPES = {
36
43
  STANDARD: 'standard',
37
44
  SATELLITE: 'satellite',
@@ -51,7 +58,7 @@ class MapView extends React.Component {
51
58
  this.map = React.createRef();
52
59
  this.fabricMap = React.createRef();
53
60
  this.state = {
54
- isReady: react_native_1.Platform.OS === 'ios',
61
+ isReady: false,
55
62
  };
56
63
  this._onMapReady = this._onMapReady.bind(this);
57
64
  this._onChange = this._onChange.bind(this);
@@ -81,13 +88,8 @@ class MapView extends React.Component {
81
88
  }
82
89
  }
83
90
  getCamera() {
84
- if (react_native_1.Platform.OS === 'android') {
85
- return react_native_1.NativeModules.AirMapModule.getCamera(this._getHandle());
86
- }
87
- else if (react_native_1.Platform.OS === 'ios') {
88
- if (this.fabricMap.current) {
89
- return this.fabricMap.current.getCamera();
90
- }
91
+ if (this.fabricMap.current) {
92
+ return this.fabricMap.current.getCamera();
91
93
  }
92
94
  return Promise.reject('getCamera not supported on this platform');
93
95
  }
@@ -115,6 +117,12 @@ class MapView extends React.Component {
115
117
  MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
116
118
  }
117
119
  }
120
+ setRegion(region) {
121
+ if (this.fabricMap.current) {
122
+ this.fabricMap.current.animateToRegion(region, 0);
123
+ }
124
+ //TODO fix for android
125
+ }
118
126
  fitToElements(options = {}) {
119
127
  const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
120
128
  if (this.fabricMap.current) {
@@ -148,13 +156,8 @@ class MapView extends React.Component {
148
156
  * @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
149
157
  */
150
158
  async getMapBoundaries() {
151
- if (react_native_1.Platform.OS === 'android') {
152
- return await react_native_1.NativeModules.AirMapModule.getMapBoundaries(this._getHandle());
153
- }
154
- else if (react_native_1.Platform.OS === 'ios') {
155
- if (this.fabricMap.current) {
156
- return this.fabricMap.current.getMapBoundaries();
157
- }
159
+ if (this.fabricMap.current) {
160
+ return this.fabricMap.current.getMapBoundaries();
158
161
  }
159
162
  return Promise.reject('getMapBoundaries not supported on this platform');
160
163
  }
@@ -198,15 +201,9 @@ class MapView extends React.Component {
198
201
  if (config.result !== 'file' && config.result !== 'base64') {
199
202
  throw new Error('Invalid result specified');
200
203
  }
201
- // Call native function
202
- if (react_native_1.Platform.OS === 'android') {
203
- return react_native_1.NativeModules.AirMapModule.takeSnapshot(this._getHandle(), config);
204
- }
205
- else if (react_native_1.Platform.OS === 'ios') {
206
- if (this.fabricMap.current) {
207
- // @ts-ignore
208
- return this.fabricMap.current.takeSnapshot(config);
209
- }
204
+ if (this.fabricMap.current) {
205
+ // @ts-ignore
206
+ return this.fabricMap.current.takeSnapshot(config);
210
207
  }
211
208
  return Promise.reject('takeSnapshot not supported on this platform');
212
209
  }
@@ -278,11 +275,9 @@ class MapView extends React.Component {
278
275
  * @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
279
276
  */
280
277
  getMarkersFrames(onlyVisible = false) {
281
- if (react_native_1.Platform.OS === 'ios') {
282
- if (this.fabricMap.current) {
283
- // @ts-ignore
284
- return this.fabricMap.current.getMarkersFrames(onlyVisible);
285
- }
278
+ if (this.fabricMap.current) {
279
+ // @ts-ignore
280
+ return this.fabricMap.current.getMarkersFrames(onlyVisible);
286
281
  }
287
282
  return Promise.reject('getMarkersFrames not supported on this platform');
288
283
  }
@@ -340,77 +335,72 @@ class MapView extends React.Component {
340
335
  this.props.onRegionChangeComplete(event.nativeEvent.region, details);
341
336
  }
342
337
  };
338
+ handleRegionChangeStarted = (event) => {
339
+ if (this.props.onRegionChangeStart) {
340
+ this.props.onRegionChangeStart(event);
341
+ }
342
+ };
343
+ handleRegionChangeComplete = (event) => {
344
+ const isGesture = event.nativeEvent.isGesture;
345
+ const details = { isGesture };
346
+ if (this.props.onRegionChangeComplete) {
347
+ this.props.onRegionChangeComplete(event.nativeEvent.region, details);
348
+ }
349
+ };
343
350
  render() {
344
- if (react_native_1.Platform.OS === 'ios') {
345
- const AIRMap = FabricMapView_1.default;
346
- // Define props specifically for MapFabricNativeProps
347
- /* eslint-disable @typescript-eslint/no-unused-vars */
348
- const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, ...restProps } = this.props;
349
- /* eslint-enable @typescript-eslint/no-unused-vars */
350
- const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
351
- const props = {
352
- onMapReady: this._onMapReady,
353
- liteMode: this.props.liteMode,
354
- googleMapId: this.props.googleMapId,
355
- googleRenderer: this.props.googleRenderer,
356
- onPress: this.handleMapPress,
357
- onMarkerPress: this.handleMarkerPress,
358
- onMarkerSelect: this.handleMarkerSelect,
359
- onMarkerDeselect: this.handleMarkerDeselect,
360
- userInterfaceStyle: userInterfaceStyle,
361
- minZoom: minZoomLevel,
362
- maxZoom: maxZoomLevel,
363
- onRegionChange: this.handleRegionChange,
364
- ...restProps,
351
+ // Define props specifically for MapFabricNativeProps
352
+ /* eslint-disable @typescript-eslint/no-unused-vars */
353
+ const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
354
+ /* eslint-enable @typescript-eslint/no-unused-vars */
355
+ const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
356
+ const props = {
357
+ onMapReady: this._onMapReady,
358
+ liteMode: this.props.liteMode,
359
+ googleMapId: this.props.googleMapId,
360
+ googleRenderer: this.props.googleRenderer,
361
+ onPress: this.handleMapPress,
362
+ onMarkerPress: this.handleMarkerPress,
363
+ onMarkerSelect: this.handleMarkerSelect,
364
+ onMarkerDeselect: this.handleMarkerDeselect,
365
+ userInterfaceStyle: userInterfaceStyle,
366
+ minZoom: minZoomLevel,
367
+ maxZoom: maxZoomLevel,
368
+ onRegionChange: this.handleRegionChange,
369
+ onRegionChangeStart: this.handleRegionChangeStarted,
370
+ onRegionChangeComplete: this.handleRegionChangeComplete,
371
+ ...restProps,
372
+ };
373
+ if (this.props.region) {
374
+ props.region = {
375
+ latitude: this.props.region.latitude,
376
+ longitude: this.props.region.longitude,
377
+ latitudeDelta: this.props.region.latitudeDelta,
378
+ longitudeDelta: this.props.region.longitudeDelta,
365
379
  };
366
- if (this.props.region) {
367
- props.region = {
368
- latitude: this.props.region.latitude,
369
- longitude: this.props.region.longitude,
370
- latitudeDelta: this.props.region.latitudeDelta,
371
- longitudeDelta: this.props.region.longitudeDelta,
372
- };
373
- }
374
- if (!this.state.isReady) {
375
- props.style = this.props.style;
376
- props.initialCamera = this.props.initialCamera;
377
- props.onLayout = this.props.onLayout;
380
+ }
381
+ if (this.state.isReady) {
382
+ if (props.onPanDrag) {
383
+ props.handlePanDrag = !!props.onPanDrag;
378
384
  }
379
- // Render AIRMap with MapFabricNativeProps
385
+ }
386
+ else {
387
+ props.style = this.props.style;
388
+ props.initialCamera = this.props.initialCamera;
389
+ props.onLayout = this.props.onLayout;
390
+ }
391
+ const childrenNodes = this.state.isReady ? children : null;
392
+ if (provider === 'google' && react_native_1.Platform.OS === 'ios') {
380
393
  return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
381
- <AIRMap {...props} ref={this.fabricMap}/>
394
+ <FabricGoogleMap {...props} ref={this.fabricMap}>
395
+ {childrenNodes}
396
+ </FabricGoogleMap>
382
397
  </decorateMapComponent_1.ProviderContext.Provider>);
383
398
  }
384
399
  else {
385
- const AIRMap = getNativeMapComponent(this.props.provider);
386
- // Define props specifically for NativeProps
387
- const props = {
388
- region: null,
389
- initialRegion: null,
390
- onChange: this._onChange,
391
- onMapReady: this._onMapReady,
392
- liteMode: this.props.liteMode,
393
- googleMapId: this.props.googleMapId,
394
- googleRenderer: this.props.googleRenderer,
395
- ref: this.map,
396
- customMapStyleString: this.props.customMapStyle
397
- ? JSON.stringify(this.props.customMapStyle)
398
- : undefined,
399
- ...this.props,
400
- };
401
- if (this.state.isReady) {
402
- if (props.onPanDrag) {
403
- props.handlePanDrag = !!props.onPanDrag;
404
- }
405
- }
406
- else {
407
- props.style = this.props.style;
408
- props.initialCamera = this.props.initialCamera;
409
- props.onLayout = this.props.onLayout;
410
- }
411
- // Render AIRMap with NativeProps
412
400
  return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
413
- <AIRMap {...props}/>
401
+ <FabricMap {...props} ref={this.fabricMap}>
402
+ {childrenNodes}
403
+ </FabricMap>
414
404
  </decorateMapComponent_1.ProviderContext.Provider>);
415
405
  }
416
406
  }
@@ -427,7 +417,6 @@ else {
427
417
  ? (0, react_native_1.requireNativeComponent)('AIRGoogleMap')
428
418
  : (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
429
419
  }
430
- const getNativeMapComponent = (provider) => airMaps[provider || 'default'];
431
420
  exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
432
421
  MapView.Animated = exports.AnimatedMapView;
433
422
  exports.default = MapView;
@@ -1,8 +1,9 @@
1
1
  import React from 'react';
2
- import type { MapBoundaries } from './specs/NativeAirMapsModule';
3
- import type { MapFabricNativeProps, Camera, Point } from './specs/NativeComponentMapView';
4
- import { LatLng, Provider, Region } from './sharedTypes';
5
- import { Address, EdgePadding, SnapshotOptions } from './MapView.types';
2
+ import type { LatLng, Point, Region } from './sharedTypes';
3
+ import type { Address, Camera, EdgePadding, SnapshotOptions } from './MapView.types';
4
+ import { MapBoundaries } from './specs/NativeAirMapsModule';
5
+ import { MapFabricNativeProps } from './specs/NativeComponentMapView';
6
+ export type FabricMapViewProps = MapFabricNativeProps;
6
7
  export interface FabricMapHandle {
7
8
  getCamera: () => Promise<Camera>;
8
9
  setCamera: (camera: Partial<Camera>) => void;
@@ -18,10 +19,5 @@ export interface FabricMapHandle {
18
19
  getPointForCoordinate: (coordinate: LatLng) => Promise<Point>;
19
20
  getCoordinateForPoint: (point: Point) => Promise<LatLng>;
20
21
  }
21
- export type FabricMapViewProps = MapFabricNativeProps & {
22
- provider?: Provider;
23
- };
24
- export declare const FabricMap: React.ForwardRefExoticComponent<MapFabricNativeProps & {
25
- provider?: Provider;
26
- } & React.RefAttributes<FabricMapHandle>>;
27
- export default FabricMap;
22
+ declare const createFabricMap: (ViewComponent: React.ComponentType, Commands: any) => React.ForwardRefExoticComponent<MapFabricNativeProps & React.RefAttributes<FabricMapHandle>>;
23
+ export default createFabricMap;