react-native-maps 1.21.0-alpha.99 → 1.22.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 (234) hide show
  1. package/README.md +9 -4
  2. package/android/build.gradle +65 -72
  3. package/android/gradle/wrapper/gradle-wrapper.properties +1 -1
  4. package/android/src/main/RCTAppDependencyProvider.h +25 -0
  5. package/android/src/main/RCTAppDependencyProvider.mm +55 -0
  6. package/android/src/main/RCTModulesConformingToProtocolsProvider.h +18 -0
  7. package/android/src/main/RCTModulesConformingToProtocolsProvider.mm +33 -0
  8. package/android/src/main/RCTThirdPartyComponentsProvider.h +16 -0
  9. package/android/src/main/RCTThirdPartyComponentsProvider.mm +28 -0
  10. package/android/src/main/ReactAppDependencyProvider.podspec +34 -0
  11. package/android/src/main/java/com/facebook/fbreact/specs/NativeAirMapsModuleSpec.java +63 -0
  12. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerDelegate.java +35 -0
  13. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCalloutManagerInterface.java +17 -0
  14. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
  15. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +23 -0
  16. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +49 -0
  17. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +23 -0
  18. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerDelegate.java +209 -0
  19. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMapViewManagerInterface.java +74 -0
  20. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +104 -0
  21. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +39 -0
  22. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +45 -0
  23. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +22 -0
  24. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +58 -0
  25. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerInterface.java +26 -0
  26. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerDelegate.java +62 -0
  27. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsUrlTileManagerInterface.java +27 -0
  28. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerDelegate.java +56 -0
  29. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsWMSTileManagerInterface.java +25 -0
  30. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +5 -1
  31. package/android/src/main/java/com/rnmaps/fabric/NativeAirMapsModule.java +1 -1
  32. package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +9 -3
  33. package/android/src/main/java/com/rnmaps/fabric/UrlTileManager.java +124 -0
  34. package/android/src/main/java/com/rnmaps/fabric/WMSTileManager.java +114 -0
  35. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +19 -3
  36. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +608 -603
  37. package/android/src/main/java/com/rnmaps/maps/MapMarkerManager.java +3 -3
  38. package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +2 -22
  39. package/android/src/main/java/com/rnmaps/maps/MapOverlayManager.java +23 -1
  40. package/android/src/main/java/com/rnmaps/maps/MapUrlTile.java +18 -18
  41. package/android/src/main/java/com/rnmaps/maps/MapUrlTileManager.java +10 -14
  42. package/android/src/main/java/com/rnmaps/maps/MapView.java +58 -49
  43. package/android/src/main/java/com/rnmaps/maps/MapWMSTile.java +3 -3
  44. package/android/src/main/java/com/rnmaps/maps/MapWMSTileManager.java +10 -10
  45. package/android/src/main/jni/CMakeLists.txt +36 -0
  46. package/android/src/main/jni/RNMapsSpecs-generated.cpp +68 -0
  47. package/android/src/main/jni/RNMapsSpecs.h +31 -0
  48. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +31 -0
  49. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +33 -0
  50. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +979 -0
  51. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +860 -0
  52. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +227 -0
  53. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +1297 -0
  54. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI-generated.cpp +74 -0
  55. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/RNMapsSpecsJSI.h +268 -0
  56. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +26 -0
  57. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +131 -0
  58. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.cpp +16 -0
  59. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/States.h +137 -0
  60. package/app.plugin.js +1 -0
  61. package/ios/AirGoogleMaps/AIRGoogleMap.h +13 -13
  62. package/ios/AirGoogleMaps/{AIRGoogleMap.m → AIRGoogleMap.mm} +32 -34
  63. package/ios/AirGoogleMaps/AIRGoogleMapManager.h +1 -0
  64. package/ios/AirGoogleMaps/AIRGoogleMapManager.mm +543 -0
  65. package/ios/AirGoogleMaps/AIRGoogleMapMarker.m +3 -3
  66. package/ios/AirGoogleMaps/AIRGoogleMapMarkerManager.m +1 -1
  67. package/ios/AirGoogleMaps/AIRGoogleMapUrlTile.m +2 -2
  68. package/ios/AirGoogleMaps/AIRGoogleMapWMSTile.m +2 -2
  69. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +5 -2
  70. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +41 -33
  71. package/ios/AirGoogleMaps/RNMapsGoogleMapViewManager.mm +16 -1
  72. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +23 -14
  73. package/ios/AirGoogleMaps/RNMapsGooglePolygonViewManager.mm +1 -0
  74. package/ios/AirMaps/AIRMap.h +8 -9
  75. package/ios/AirMaps/{AIRMap.m → AIRMap.mm} +18 -14
  76. package/ios/AirMaps/AIRMapManager.m +8 -19
  77. package/ios/AirMaps/AIRMapMarker.m +57 -44
  78. package/ios/AirMaps/AIRMapOverlay.m +2 -2
  79. package/ios/AirMaps/AIRMapWMSTile.m +8 -8
  80. package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.h +25 -0
  81. package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +77 -0
  82. package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.h +25 -0
  83. package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +51 -0
  84. package/ios/AirMaps/RNMapsAirModule.h +2 -3
  85. package/ios/AirMaps/RNMapsAirModule.mm +14 -0
  86. package/ios/AirMaps/RNMapsDefines.h +1 -0
  87. package/ios/AirMaps/RNMapsMapView.h +5 -2
  88. package/ios/AirMaps/RNMapsMapView.mm +16 -6
  89. package/ios/AirMaps/RNMapsMapViewManager.mm +19 -1
  90. package/ios/AirMaps/RNMapsMarkerView.mm +12 -4
  91. package/ios/AirMaps/RNMapsMarkerViewManager.mm +7 -0
  92. package/ios/AirMaps/module.modulemap +6 -0
  93. package/ios/AirMaps.xcodeproj/project.pbxproj +15 -55
  94. package/ios/generated/RCTAppDependencyProvider.h +25 -0
  95. package/ios/generated/RCTAppDependencyProvider.mm +55 -0
  96. package/ios/generated/RCTModulesConformingToProtocolsProvider.h +18 -0
  97. package/ios/generated/RCTModulesConformingToProtocolsProvider.mm +33 -0
  98. package/ios/generated/RCTThirdPartyComponentsProvider.h +16 -0
  99. package/ios/generated/RCTThirdPartyComponentsProvider.mm +26 -0
  100. package/ios/{AirMaps → generated}/RNMapsAirModuleDelegate.h +1 -1
  101. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +29 -0
  102. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +31 -0
  103. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +977 -0
  104. package/ios/generated/RNMapsSpecs/EventEmitters.h +846 -0
  105. package/ios/generated/RNMapsSpecs/Props.cpp +194 -0
  106. package/ios/generated/RNMapsSpecs/Props.h +1224 -0
  107. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +591 -0
  108. package/ios/generated/RNMapsSpecs/RNMapsSpecs-generated.mm +92 -0
  109. package/ios/generated/RNMapsSpecs/RNMapsSpecs.h +137 -0
  110. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +24 -0
  111. package/ios/generated/RNMapsSpecs/ShadowNodes.h +109 -0
  112. package/ios/generated/RNMapsSpecs/States.cpp +16 -0
  113. package/ios/generated/RNMapsSpecs/States.h +113 -0
  114. package/ios/generated/RNMapsSpecsJSI-generated.cpp +74 -0
  115. package/ios/generated/RNMapsSpecsJSI.h +268 -0
  116. package/ios/generated/ReactAppDependencyProvider.podspec +34 -0
  117. package/ios/generated/module.modulemap +15 -0
  118. package/package.json +34 -27
  119. package/plugin/build/android.js +58 -0
  120. package/plugin/build/index.js +10 -0
  121. package/plugin/build/ios.js +172 -0
  122. package/react-native-google-maps.podspec +27 -0
  123. package/react-native-maps-generated.podspec +31 -0
  124. package/react-native-maps.podspec +52 -46
  125. package/react-native.config.js +16 -0
  126. package/src/AnimatedRegion.ts +169 -0
  127. package/src/Geojson.tsx +541 -0
  128. package/src/MapCallout.tsx +77 -0
  129. package/src/MapCalloutSubview.tsx +64 -0
  130. package/src/MapCircle.tsx +162 -0
  131. package/src/MapHeatmap.tsx +125 -0
  132. package/src/MapLocalTile.tsx +60 -0
  133. package/src/MapMarker.tsx +531 -0
  134. package/src/MapMarkerNativeComponent.ts +51 -0
  135. package/src/MapOverlay.tsx +178 -0
  136. package/src/MapPolygon.tsx +188 -0
  137. package/src/MapPolygon.types.ts +25 -0
  138. package/src/MapPolyline.tsx +215 -0
  139. package/src/MapUrlTile.tsx +169 -0
  140. package/src/MapView.tsx +1230 -0
  141. package/src/MapView.types.ts +212 -0
  142. package/src/MapView.web.ts +2 -0
  143. package/src/MapViewNativeComponent.ts +86 -0
  144. package/src/MapWMSTile.tsx +148 -0
  145. package/src/ProviderConstants.ts +2 -0
  146. package/src/createFabricMap.tsx +253 -0
  147. package/src/decorateMapComponent.ts +229 -0
  148. package/src/fixImageProp.ts +17 -0
  149. package/src/index.ts +52 -0
  150. package/src/sharedTypes.ts +101 -0
  151. package/{specs → src/specs}/NativeComponentCircle.ts +3 -4
  152. package/{specs → src/specs}/NativeComponentGoogleMapView.ts +15 -9
  153. package/{specs → src/specs}/NativeComponentMapView.ts +61 -32
  154. package/{specs → src/specs}/NativeComponentOverlay.ts +11 -2
  155. package/{specs → src/specs}/NativeComponentPolyline.ts +1 -1
  156. package/src/specs/NativeComponentUrlTile.ts +128 -0
  157. package/src/specs/NativeComponentWMSTile.ts +107 -0
  158. package/ios/AirGoogleMaps/AIRGoogleMapManager.m +0 -533
  159. package/lib/AnimatedRegion.d.ts +0 -19
  160. package/lib/AnimatedRegion.js +0 -134
  161. package/lib/Geojson.d.ts +0 -204
  162. package/lib/Geojson.js +0 -166
  163. package/lib/MapCallout.d.ts +0 -40
  164. package/lib/MapCallout.js +0 -51
  165. package/lib/MapCalloutSubview.d.ts +0 -34
  166. package/lib/MapCalloutSubview.js +0 -48
  167. package/lib/MapCircle.d.ts +0 -117
  168. package/lib/MapCircle.js +0 -53
  169. package/lib/MapHeatmap.d.ts +0 -78
  170. package/lib/MapHeatmap.js +0 -59
  171. package/lib/MapLocalTile.d.ts +0 -35
  172. package/lib/MapLocalTile.js +0 -44
  173. package/lib/MapMarker.d.ts +0 -322
  174. package/lib/MapMarker.js +0 -158
  175. package/lib/MapMarkerNativeComponent.d.ts +0 -15
  176. package/lib/MapMarkerNativeComponent.js +0 -15
  177. package/lib/MapOverlay.d.ts +0 -88
  178. package/lib/MapOverlay.js +0 -65
  179. package/lib/MapPolygon.d.ts +0 -140
  180. package/lib/MapPolygon.js +0 -53
  181. package/lib/MapPolygon.types.d.ts +0 -18
  182. package/lib/MapPolyline.d.ts +0 -156
  183. package/lib/MapPolyline.js +0 -53
  184. package/lib/MapUrlTile.d.ts +0 -134
  185. package/lib/MapUrlTile.js +0 -44
  186. package/lib/MapView.d.ts +0 -703
  187. package/lib/MapView.js +0 -427
  188. package/lib/MapView.types.d.ts +0 -161
  189. package/lib/MapView.types.js +0 -2
  190. package/lib/MapView.web.d.ts +0 -1
  191. package/lib/MapView.web.js +0 -9
  192. package/lib/MapViewNativeComponent.d.ts +0 -18
  193. package/lib/MapViewNativeComponent.js +0 -19
  194. package/lib/MapWMSTile.d.ts +0 -116
  195. package/lib/MapWMSTile.js +0 -44
  196. package/lib/ProviderConstants.d.ts +0 -2
  197. package/lib/ProviderConstants.js +0 -5
  198. package/lib/createFabricMap.d.ts +0 -24
  199. package/lib/createFabricMap.js +0 -188
  200. package/lib/decorateMapComponent.d.ts +0 -36
  201. package/lib/decorateMapComponent.js +0 -120
  202. package/lib/fixImageProp.d.ts +0 -4
  203. package/lib/fixImageProp.js +0 -16
  204. package/lib/index.d.ts +0 -38
  205. package/lib/index.js +0 -81
  206. package/lib/sharedTypes.d.ts +0 -81
  207. package/lib/sharedTypes.js +0 -2
  208. package/lib/sharedTypesInternal.js +0 -2
  209. package/lib/specs/NativeAirMapsModule.d.ts +0 -31
  210. package/lib/specs/NativeAirMapsModule.js +0 -4
  211. package/lib/specs/NativeComponentCallout.d.ts +0 -46
  212. package/lib/specs/NativeComponentCallout.js +0 -9
  213. package/lib/specs/NativeComponentCircle.d.ts +0 -74
  214. package/lib/specs/NativeComponentCircle.js +0 -7
  215. package/lib/specs/NativeComponentGoogleMapView.d.ts +0 -713
  216. package/lib/specs/NativeComponentGoogleMapView.js +0 -22
  217. package/lib/specs/NativeComponentGooglePolygon.d.ts +0 -75
  218. package/lib/specs/NativeComponentGooglePolygon.js +0 -7
  219. package/lib/specs/NativeComponentMapView.d.ts +0 -847
  220. package/lib/specs/NativeComponentMapView.js +0 -20
  221. package/lib/specs/NativeComponentMarker.d.ts +0 -258
  222. package/lib/specs/NativeComponentMarker.js +0 -19
  223. package/lib/specs/NativeComponentOverlay.d.ts +0 -67
  224. package/lib/specs/NativeComponentOverlay.js +0 -7
  225. package/lib/specs/NativeComponentPolyline.d.ts +0 -101
  226. package/lib/specs/NativeComponentPolyline.js +0 -7
  227. /package/ios/AirMaps/{UIView +AirMap.m → UIView+AirMap.m} +0 -0
  228. /package/ios/{AirMaps → generated}/RNMapsHostVewDelegate.h +0 -0
  229. /package/{lib/MapPolygon.types.js → plugin/build/types.js} +0 -0
  230. /package/{lib/sharedTypesInternal.d.ts → src/sharedTypesInternal.ts} +0 -0
  231. /package/{specs → src/specs}/NativeAirMapsModule.ts +0 -0
  232. /package/{specs → src/specs}/NativeComponentCallout.ts +0 -0
  233. /package/{specs → src/specs}/NativeComponentGooglePolygon.ts +0 -0
  234. /package/{specs → src/specs}/NativeComponentMarker.ts +0 -0
package/lib/MapView.js DELETED
@@ -1,427 +0,0 @@
1
- "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
- var __importDefault = (this && this.__importDefault) || function (mod) {
26
- return (mod && mod.__esModule) ? mod : { "default": mod };
27
- };
28
- Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.AnimatedMapView = exports.MAP_TYPES = void 0;
30
- const React = __importStar(require("react"));
31
- const react_native_1 = require("react-native");
32
- const decorateMapComponent_1 = require("./decorateMapComponent");
33
- const MapViewNativeComponent_1 = require("./MapViewNativeComponent");
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
- }
42
- exports.MAP_TYPES = {
43
- STANDARD: 'standard',
44
- SATELLITE: 'satellite',
45
- HYBRID: 'hybrid',
46
- TERRAIN: 'terrain',
47
- NONE: 'none',
48
- MUTEDSTANDARD: 'mutedStandard',
49
- SATELLITE_FLYOVER: 'satelliteFlyover',
50
- HYBRID_FLYOVER: 'hybridFlyover',
51
- };
52
- class MapView extends React.Component {
53
- static Animated;
54
- map;
55
- fabricMap;
56
- constructor(props) {
57
- super(props);
58
- this.map = React.createRef();
59
- this.fabricMap = React.createRef();
60
- this.state = {
61
- isReady: false,
62
- };
63
- this._onMapReady = this._onMapReady.bind(this);
64
- this._onChange = this._onChange.bind(this);
65
- }
66
- setNativeProps(props) {
67
- // @ts-ignore
68
- this.map.current?.setNativeProps(props);
69
- }
70
- _onMapReady() {
71
- const { onMapReady } = this.props;
72
- this.setState({ isReady: true }, () => {
73
- if (onMapReady) {
74
- onMapReady();
75
- }
76
- });
77
- }
78
- _onChange({ nativeEvent }) {
79
- const isGesture = nativeEvent.isGesture;
80
- const details = { isGesture };
81
- if (nativeEvent.continuous) {
82
- if (this.props.onRegionChange) {
83
- this.props.onRegionChange(nativeEvent.region, details);
84
- }
85
- }
86
- else if (this.props.onRegionChangeComplete) {
87
- this.props.onRegionChangeComplete(nativeEvent.region, details);
88
- }
89
- }
90
- getCamera() {
91
- if (this.fabricMap.current) {
92
- return this.fabricMap.current.getCamera();
93
- }
94
- return Promise.reject('getCamera not supported on this platform');
95
- }
96
- setCamera(camera) {
97
- if (this.fabricMap.current) {
98
- this.fabricMap.current.setCamera(camera);
99
- }
100
- else if (this.map.current) {
101
- MapViewNativeComponent_1.Commands.setCamera(this.map.current, camera);
102
- }
103
- }
104
- animateCamera(camera, opts) {
105
- if (this.fabricMap.current) {
106
- this.fabricMap.current.animateCamera(camera, opts?.duration ? opts.duration : 500);
107
- }
108
- else if (this.map.current) {
109
- MapViewNativeComponent_1.Commands.animateCamera(this.map.current, camera, opts?.duration ? opts.duration : 500);
110
- }
111
- }
112
- animateToRegion(region, duration = 500) {
113
- if (this.fabricMap.current) {
114
- this.fabricMap.current.animateToRegion(region, duration);
115
- }
116
- else if (this.map.current) {
117
- MapViewNativeComponent_1.Commands.animateToRegion(this.map.current, region, duration);
118
- }
119
- }
120
- setRegion(region) {
121
- if (this.fabricMap.current) {
122
- this.fabricMap.current.animateToRegion(region, 0);
123
- }
124
- //TODO fix for android
125
- }
126
- fitToElements(options = {}) {
127
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
128
- if (this.fabricMap.current) {
129
- this.fabricMap.current.fitToElements(edgePadding, animated);
130
- }
131
- else if (this.map.current) {
132
- MapViewNativeComponent_1.Commands.fitToElements(this.map.current, edgePadding, animated);
133
- }
134
- }
135
- fitToSuppliedMarkers(markers, options = {}) {
136
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
137
- if (this.fabricMap.current) {
138
- this.fabricMap.current.fitToSuppliedMarkers(markers, edgePadding, animated);
139
- }
140
- else if (this.map.current) {
141
- MapViewNativeComponent_1.Commands.fitToSuppliedMarkers(this.map.current, markers, edgePadding, animated);
142
- }
143
- }
144
- fitToCoordinates(coordinates = [], options = {}) {
145
- const { edgePadding = { top: 0, right: 0, bottom: 0, left: 0 }, animated = true, } = options;
146
- if (this.fabricMap.current) {
147
- this.fabricMap.current.fitToCoordinates(coordinates, edgePadding, animated);
148
- }
149
- else if (this.map.current) {
150
- MapViewNativeComponent_1.Commands.fitToCoordinates(this.map.current, coordinates, edgePadding, animated);
151
- }
152
- }
153
- /**
154
- * Get visible boudaries
155
- *
156
- * @return Promise Promise with the bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
157
- */
158
- async getMapBoundaries() {
159
- if (this.fabricMap.current) {
160
- return this.fabricMap.current.getMapBoundaries();
161
- }
162
- return Promise.reject('getMapBoundaries not supported on this platform');
163
- }
164
- setMapBoundaries(northEast, southWest) {
165
- if (this.map.current) {
166
- MapViewNativeComponent_1.Commands.setMapBoundaries(this.map.current, northEast, southWest);
167
- }
168
- }
169
- setIndoorActiveLevelIndex(activeLevelIndex) {
170
- if (this.fabricMap.current) {
171
- return this.fabricMap.current.setIndoorActiveLevelIndex(activeLevelIndex);
172
- }
173
- return Promise.reject('getMapBoundaries not supported on this platform');
174
- }
175
- /**
176
- * Takes a snapshot of the map and saves it to a picture
177
- * file or returns the image as a base64 encoded string.
178
- *
179
- * @param args Configuration options
180
- * @param [args.width] Width of the rendered map-view (when omitted actual view width is used).
181
- * @param [args.height] Height of the rendered map-view (when omitted actual height is used).
182
- * @param [args.region] Region to render (Only supported on iOS).
183
- * @param [args.format] Encoding format ('png', 'jpg') (default: 'png').
184
- * @param [args.quality] Compression quality (only used for jpg) (default: 1.0).
185
- * @param [args.result] Result format ('file', 'base64') (default: 'file').
186
- *
187
- * @return Promise Promise with either the file-uri or base64 encoded string
188
- */
189
- takeSnapshot(args) {
190
- // Sanitize inputs
191
- const config = {
192
- width: args.width || 0,
193
- height: args.height || 0,
194
- region: args.region || {},
195
- format: args.format || 'png',
196
- quality: args.quality || 1.0,
197
- result: args.result || 'file',
198
- };
199
- if (config.format !== 'png' && config.format !== 'jpg') {
200
- throw new Error('Invalid format specified');
201
- }
202
- if (config.result !== 'file' && config.result !== 'base64') {
203
- throw new Error('Invalid result specified');
204
- }
205
- if (this.fabricMap.current) {
206
- // @ts-ignore
207
- return this.fabricMap.current.takeSnapshot(config);
208
- }
209
- return Promise.reject('takeSnapshot not supported on this platform');
210
- }
211
- /**
212
- * Convert a coordinate to address by using default Geocoder
213
- *
214
- * @param coordinate Coordinate
215
- * @param [coordinate.latitude] Latitude
216
- * @param [coordinate.longitude] Longitude
217
- *
218
- * @return Promise with return type Address
219
- */
220
- addressForCoordinate(coordinate) {
221
- if (this.fabricMap.current) {
222
- return this.fabricMap.current.getAddressFromCoordinates(coordinate);
223
- }
224
- return Promise.reject('getAddress not supported on this platform');
225
- }
226
- /**
227
- * Convert a map coordinate to user-space point
228
- *
229
- * @param coordinate Coordinate
230
- * @param [coordinate.latitude] Latitude
231
- * @param [coordinate.longitude] Longitude
232
- *
233
- * @return Promise Promise with the point ({ x: Number, y: Number })
234
- */
235
- pointForCoordinate(coordinate) {
236
- if (this.fabricMap.current) {
237
- return this.fabricMap.current.getPointForCoordinate(coordinate);
238
- }
239
- return Promise.reject('pointForCoordinate not supported on this platform');
240
- }
241
- /**
242
- * Convert a user-space point to a map coordinate
243
- *
244
- * @param point Point
245
- * @param [point.x] X
246
- * @param [point.x] Y
247
- *
248
- * @return Promise Promise with the coordinate ({ latitude: Number, longitude: Number })
249
- */
250
- coordinateForPoint(point) {
251
- if (this.fabricMap.current) {
252
- return this.fabricMap.current.getCoordinateForPoint(point);
253
- }
254
- return Promise.reject('coordinateForPoint not supported on this platform');
255
- }
256
- /**
257
- * Get markers' centers and frames in user-space coordinates
258
- *
259
- * @param onlyVisible boolean true to include only visible markers, false to include all
260
- *
261
- * @return Promise Promise with { <identifier>: { point: Point, frame: Frame } }
262
- */
263
- getMarkersFrames(onlyVisible = false) {
264
- if (this.fabricMap.current) {
265
- // @ts-ignore
266
- return this.fabricMap.current.getMarkersFrames(onlyVisible);
267
- }
268
- return Promise.reject('getMarkersFrames not supported on this platform');
269
- }
270
- /**
271
- * Get bounding box from region
272
- *
273
- * @param region Region
274
- *
275
- * @return Object Object bounding box ({ northEast: <LatLng>, southWest: <LatLng> })
276
- */
277
- boundingBoxForRegion(region) {
278
- return {
279
- northEast: {
280
- latitude: region.latitude + region.latitudeDelta / 2,
281
- longitude: region.longitude + region.longitudeDelta / 2,
282
- },
283
- southWest: {
284
- latitude: region.latitude - region.latitudeDelta / 2,
285
- longitude: region.longitude - region.longitudeDelta / 2,
286
- },
287
- };
288
- }
289
- _getHandle() {
290
- return (0, react_native_1.findNodeHandle)(this.map.current);
291
- }
292
- handleMapPress = (event) => {
293
- if (this.props.onPress) {
294
- this.props.onPress(event);
295
- }
296
- };
297
- handleMarkerPress = (event) => {
298
- if (this.props.onMarkerPress) {
299
- this.props.onMarkerPress(event);
300
- }
301
- };
302
- handleMarkerSelect = (event) => {
303
- if (this.props.onMarkerSelect) {
304
- this.props.onMarkerSelect(event);
305
- }
306
- };
307
- handleKmlReady = (event) => {
308
- if (this.props.onKmlReady) {
309
- this.props.onKmlReady(event);
310
- }
311
- };
312
- handleMarkerDeselect = (event) => {
313
- if (this.props.onMarkerDeselect) {
314
- this.props.onMarkerDeselect(event);
315
- }
316
- };
317
- handleRegionChange = (event) => {
318
- const isGesture = event.nativeEvent.isGesture;
319
- const details = { isGesture };
320
- if (event.nativeEvent.continuous) {
321
- if (this.props.onRegionChange) {
322
- this.props.onRegionChange(event.nativeEvent.region, details);
323
- }
324
- }
325
- else if (this.props.onRegionChangeComplete) {
326
- this.props.onRegionChangeComplete(event.nativeEvent.region, details);
327
- }
328
- };
329
- handleRegionChangeStarted = (event) => {
330
- if (this.props.onRegionChangeStart) {
331
- this.props.onRegionChangeStart(event);
332
- }
333
- };
334
- handleIndoorBuildingFocused = (event) => {
335
- if (this.props.onIndoorBuildingFocused) {
336
- this.props.onIndoorBuildingFocused(event);
337
- }
338
- };
339
- handleIndoorLevelActivated = (event) => {
340
- if (this.props.onIndoorLevelActivated) {
341
- this.props.onIndoorLevelActivated(event);
342
- }
343
- };
344
- handleRegionChangeComplete = (event) => {
345
- const isGesture = event.nativeEvent.isGesture;
346
- const details = { isGesture };
347
- if (this.props.onRegionChangeComplete) {
348
- this.props.onRegionChangeComplete(event.nativeEvent.region, details);
349
- }
350
- };
351
- render() {
352
- // Define props specifically for MapFabricNativeProps
353
- /* eslint-disable @typescript-eslint/no-unused-vars */
354
- const { onCalloutPress, onIndoorBuildingFocused, onKmlReady, onLongPress, onMarkerDeselect, onMarkerPress, onMarkerSelect, onRegionChangeStart, onRegionChange, onRegionChangeComplete, onPress, minZoomLevel, maxZoomLevel, region, provider, children, ...restProps } = this.props;
355
- /* eslint-enable @typescript-eslint/no-unused-vars */
356
- const userInterfaceStyle = this.props.userInterfaceStyle || 'system';
357
- const props = {
358
- onMapReady: this._onMapReady,
359
- liteMode: this.props.liteMode,
360
- googleMapId: this.props.googleMapId,
361
- googleRenderer: this.props.googleRenderer,
362
- onPress: this.handleMapPress,
363
- onMarkerPress: this.handleMarkerPress,
364
- onMarkerSelect: this.handleMarkerSelect,
365
- onMarkerDeselect: this.handleMarkerDeselect,
366
- onKmlReady: this.handleKmlReady,
367
- userInterfaceStyle: userInterfaceStyle,
368
- minZoom: minZoomLevel,
369
- maxZoom: maxZoomLevel,
370
- onRegionChange: this.handleRegionChange,
371
- onRegionChangeStart: this.handleRegionChangeStarted,
372
- onRegionChangeComplete: this.handleRegionChangeComplete,
373
- onIndoorBuildingFocused: this.handleIndoorBuildingFocused,
374
- // @ts-ignore
375
- onIndoorLevelActivated: this.handleIndoorLevelActivated,
376
- ...restProps,
377
- };
378
- if (this.props.region) {
379
- props.region = {
380
- latitude: this.props.region.latitude,
381
- longitude: this.props.region.longitude,
382
- latitudeDelta: this.props.region.latitudeDelta,
383
- longitudeDelta: this.props.region.longitudeDelta,
384
- };
385
- }
386
- if (this.state.isReady) {
387
- if (props.onPanDrag) {
388
- props.handlePanDrag = !!props.onPanDrag;
389
- }
390
- }
391
- else {
392
- props.style = this.props.style;
393
- props.initialCamera = this.props.initialCamera;
394
- props.onLayout = this.props.onLayout;
395
- }
396
- const childrenNodes = this.state.isReady ? children : null;
397
- if (provider === 'google' && react_native_1.Platform.OS === 'ios') {
398
- return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
399
- <FabricGoogleMap {...props} ref={this.fabricMap}>
400
- {childrenNodes}
401
- </FabricGoogleMap>
402
- </decorateMapComponent_1.ProviderContext.Provider>);
403
- }
404
- else {
405
- return (<decorateMapComponent_1.ProviderContext.Provider value={this.props.provider}>
406
- <FabricMap {...props} ref={this.fabricMap}>
407
- {childrenNodes}
408
- </FabricMap>
409
- </decorateMapComponent_1.ProviderContext.Provider>);
410
- }
411
- }
412
- }
413
- const airMaps = {
414
- default: (0, react_native_1.requireNativeComponent)('AIRMap'),
415
- google: () => null,
416
- };
417
- if (react_native_1.Platform.OS === 'android') {
418
- airMaps.google = airMaps.default;
419
- }
420
- else {
421
- airMaps.google = decorateMapComponent_1.googleMapIsInstalled
422
- ? (0, react_native_1.requireNativeComponent)('AIRGoogleMap')
423
- : (0, decorateMapComponent_1.createNotSupportedComponent)('react-native-maps: AirGoogleMaps dir must be added to your xCode project to support GoogleMaps on iOS.');
424
- }
425
- exports.AnimatedMapView = react_native_1.Animated.createAnimatedComponent(MapView);
426
- MapView.Animated = exports.AnimatedMapView;
427
- exports.default = MapView;
@@ -1,161 +0,0 @@
1
- import { ClickEvent, LatLng, Point, Region } from './sharedTypes';
2
- import { NativeSyntheticEvent } from 'react-native';
3
- export type Camera = {
4
- /**
5
- * Apple Maps
6
- */
7
- altitude?: number;
8
- center: LatLng;
9
- heading: number;
10
- pitch: number;
11
- /**
12
- * Google Maps
13
- */
14
- zoom?: number;
15
- };
16
- export type MapStyleElement = {
17
- featureType?: string;
18
- elementType?: string;
19
- stylers: object[];
20
- };
21
- export type EdgePadding = {
22
- top: number;
23
- right: number;
24
- bottom: number;
25
- left: number;
26
- };
27
- export type MapType = 'hybrid' | 'mutedStandard' | 'none' | 'satellite' | 'standard' | 'terrain' | 'satelliteFlyover' | 'hybridFlyover';
28
- export type MapTypes = {
29
- STANDARD: 'standard';
30
- SATELLITE: 'satellite';
31
- HYBRID: 'hybrid';
32
- TERRAIN: 'terrain';
33
- NONE: 'none';
34
- MUTEDSTANDARD: 'mutedStandard';
35
- SATELLITE_FLYOVER: 'satelliteFlyover';
36
- HYBRID_FLYOVER: 'hybridFlyover';
37
- };
38
- export type IndoorLevel = {
39
- index: number;
40
- name: string;
41
- shortName: string;
42
- };
43
- export type ActiveIndoorLevel = {
44
- activeLevelIndex: number;
45
- name: string;
46
- shortName: string;
47
- };
48
- export type IndoorLevelActivatedEvent = NativeSyntheticEvent<{
49
- indoorLevel: ActiveIndoorLevel;
50
- }>;
51
- export type IndoorBuilding = {
52
- underground: boolean;
53
- activeLevelIndex: number;
54
- levels: IndoorLevel[];
55
- };
56
- export type IndoorBuildingEvent = NativeSyntheticEvent<{
57
- IndoorBuilding: IndoorBuilding;
58
- }>;
59
- export type KmlMarker = {
60
- id: string;
61
- title: string;
62
- description: string;
63
- coordinate: LatLng;
64
- position: Point;
65
- };
66
- export type KmlMapEvent = NativeSyntheticEvent<{
67
- markers: KmlMarker[];
68
- }>;
69
- export type LongPressEvent = ClickEvent<{
70
- /**
71
- * @platform Android
72
- */
73
- action?: 'long-press';
74
- }>;
75
- export type PanDragEvent = ClickEvent;
76
- export type PoiClickEvent = NativeSyntheticEvent<{
77
- placeId: string;
78
- name: string;
79
- coordinate: LatLng;
80
- /**
81
- * @platform Android
82
- */
83
- position?: Point;
84
- }>;
85
- export type MapPressEvent = ClickEvent<{
86
- /**
87
- * @platform Android
88
- */
89
- action?: 'press' | 'marker-press';
90
- }>;
91
- export type Details = {
92
- isGesture?: boolean;
93
- };
94
- export type UserLocationChangeEvent = NativeSyntheticEvent<{
95
- coordinate?: LatLng & {
96
- altitude: number;
97
- timestamp: number;
98
- accuracy: number;
99
- speed: number;
100
- heading: number;
101
- /**
102
- * @platform iOS
103
- */
104
- altitudeAccuracy?: number;
105
- /**
106
- * @platform Android
107
- */
108
- isFromMockProvider?: boolean;
109
- };
110
- /**
111
- * @platform iOS
112
- */
113
- error?: {
114
- message: string;
115
- };
116
- }>;
117
- export type ChangeEvent = NativeSyntheticEvent<{
118
- continuous: boolean;
119
- region: Region;
120
- isGesture?: boolean;
121
- }>;
122
- export type FitToOptions = {
123
- edgePadding?: EdgePadding;
124
- animated?: boolean;
125
- };
126
- export type BoundingBox = {
127
- northEast: LatLng;
128
- southWest: LatLng;
129
- };
130
- export type SnapshotOptions = {
131
- /** optional, when omitted the view-width is used */
132
- width?: number;
133
- /** optional, when omitted the view-height is used */
134
- height?: number;
135
- /** __iOS only__, optional region to render */
136
- region?: Region;
137
- /** image formats, defaults to 'png' */
138
- format?: 'png' | 'jpg';
139
- /** image quality: 0..1 (only relevant for jpg, default: 1) */
140
- quality?: number;
141
- /** result types, defaults to 'file' */
142
- result?: 'file' | 'base64';
143
- };
144
- export type Address = {
145
- administrativeArea: string;
146
- country: string;
147
- countryCode: string;
148
- locality: string;
149
- name: string;
150
- postalCode: string;
151
- subAdministrativeArea: string;
152
- subLocality: string;
153
- thoroughfare: string;
154
- subThoroughfare?: string;
155
- };
156
- export type CameraZoomRange = {
157
- minCenterCoordinateDistance?: number;
158
- maxCenterCoordinateDistance?: number;
159
- animated?: boolean;
160
- };
161
- export type NativeCommandName = 'animateCamera' | 'animateToRegion' | 'coordinateForPoint' | 'fitToCoordinates' | 'fitToElements' | 'fitToSuppliedMarkers' | 'getAddressFromCoordinates' | 'getCamera' | 'getMapBoundaries' | 'getMarkersFrames' | 'pointForCoordinate' | 'setCamera' | 'setIndoorActiveLevelIndex' | 'setMapBoundaries' | 'takeSnapshot';
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
@@ -1 +0,0 @@
1
- export { default } from 'react-native-web/dist/modules/UnimplementedView';
@@ -1,9 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.default = void 0;
7
- //@ts-ignore
8
- var UnimplementedView_1 = require("react-native-web/dist/modules/UnimplementedView");
9
- Object.defineProperty(exports, "default", { enumerable: true, get: function () { return __importDefault(UnimplementedView_1).default; } });
@@ -1,18 +0,0 @@
1
- /// <reference types="react" />
2
- import type { HostComponent } from 'react-native';
3
- import { NativeProps } from './MapView';
4
- import { Camera, EdgePadding } from './MapView.types';
5
- import { LatLng, Region } from './sharedTypes';
6
- export type MapViewNativeComponentType = HostComponent<NativeProps>;
7
- interface NativeCommands {
8
- animateToRegion: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, region: Region, duration: number) => void;
9
- setCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>) => void;
10
- animateCamera: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, camera: Partial<Camera>, duration: number) => void;
11
- fitToElements: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, edgePadding: EdgePadding, animated: boolean) => void;
12
- fitToSuppliedMarkers: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, markers: string[], edgePadding: EdgePadding, animated: boolean) => void;
13
- fitToCoordinates: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, coordinates: LatLng[], edgePadding: EdgePadding, animated: boolean) => void;
14
- setMapBoundaries: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, northEast: LatLng, southWest: LatLng) => void;
15
- setIndoorActiveLevelIndex: (viewRef: NonNullable<React.RefObject<MapViewNativeComponentType>['current']>, activeLevelIndex: number) => void;
16
- }
17
- export declare const Commands: NativeCommands;
18
- export {};
@@ -1,19 +0,0 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Commands = void 0;
7
- const codegenNativeCommands_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeCommands"));
8
- exports.Commands = (0, codegenNativeCommands_1.default)({
9
- supportedCommands: [
10
- 'animateToRegion',
11
- 'setCamera',
12
- 'animateCamera',
13
- 'fitToElements',
14
- 'fitToSuppliedMarkers',
15
- 'fitToCoordinates',
16
- 'setMapBoundaries',
17
- 'setIndoorActiveLevelIndex',
18
- ],
19
- });