react-native-maps 1.25.0-alpha.8 → 1.25.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 (86) hide show
  1. package/README.md +2 -53
  2. package/android/src/main/RCTThirdPartyComponentsProvider.mm +0 -2
  3. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +1 -1
  4. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerDelegate.java +3 -0
  5. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsGooglePolygonManagerInterface.java +1 -0
  6. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerDelegate.java +6 -0
  7. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsMarkerManagerInterface.java +2 -0
  8. package/android/src/main/java/com/facebook/react/viewmanagers/RNMapsPolylineManagerDelegate.java +1 -1
  9. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +1 -1
  10. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +41 -5
  11. package/android/src/main/java/com/rnmaps/fabric/PolygonManager.java +9 -2
  12. package/android/src/main/java/com/rnmaps/fabric/event/OnRegionChangeEvent.java +1 -2
  13. package/android/src/main/java/com/rnmaps/maps/MapMarker.java +46 -3
  14. package/android/src/main/java/com/rnmaps/maps/MapPolyline.java +8 -1
  15. package/android/src/main/java/com/rnmaps/maps/MapView.java +104 -51
  16. package/android/src/main/java/com/rnmaps/maps/MapsPackage.java +84 -27
  17. package/android/src/main/java/com/rnmaps/maps/RegionChangeEvent.java +1 -4
  18. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +6 -6
  19. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +6 -6
  20. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.cpp +5 -2
  21. package/android/src/main/jni/react/renderer/components/RNMapsSpecs/Props.h +27 -2
  22. package/ios/AirGoogleMaps/AIRGoogleMap.mm +13 -12
  23. package/ios/AirGoogleMaps/AIRGoogleMapPolyline.m +4 -0
  24. package/ios/AirGoogleMaps/RNMapsGoogleMapView.h +3 -3
  25. package/ios/AirGoogleMaps/RNMapsGoogleMapView.mm +6 -6
  26. package/ios/AirGoogleMaps/RNMapsGooglePolygonView.mm +4 -4
  27. package/ios/AirMaps/AIRMap.h +2 -1
  28. package/ios/AirMaps/AIRMapManager.m +34 -18
  29. package/ios/AirMaps/AIRMapMarker.m +7 -1
  30. package/ios/AirMaps/FabricPlaceholders/PlaceHolderGoogleMapView.mm +2 -2
  31. package/ios/AirMaps/FabricPlaceholders/PlaceHolderPolygonView.mm +1 -1
  32. package/ios/AirMaps/RNMapsAirModule.mm +3 -3
  33. package/ios/AirMaps/RNMapsMapView.h +4 -4
  34. package/ios/AirMaps/RNMapsMapView.mm +55 -10
  35. package/ios/AirMaps/RNMapsMapViewManager.mm +1 -1
  36. package/ios/AirMaps/RNMapsMarkerView.mm +4 -3
  37. package/ios/generated/RNMapsAirModuleDelegate.h +1 -1
  38. package/ios/generated/{RNMapsHostVewDelegate.h → RNMapsHostViewDelegate.h} +1 -1
  39. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
  40. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
  41. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +8 -6
  42. package/ios/generated/RNMapsSpecs/EventEmitters.h +20 -6
  43. package/ios/generated/RNMapsSpecs/Props.cpp +37 -2
  44. package/ios/generated/RNMapsSpecs/Props.h +110 -13
  45. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
  46. package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
  47. package/ios/generated/RNMapsSpecs/States.h +24 -0
  48. package/ios/generated/module.modulemap +1 -1
  49. package/package.json +9 -3
  50. package/plugin/build/ios.js +3 -3
  51. package/src/AnimatedRegion.ts +3 -1
  52. package/src/Geojson.tsx +5 -5
  53. package/src/MapCallout.tsx +5 -5
  54. package/src/MapCalloutSubview.tsx +9 -5
  55. package/src/MapCircle.tsx +5 -5
  56. package/src/MapHeatmap.tsx +11 -6
  57. package/src/MapLocalTile.tsx +4 -4
  58. package/src/MapMarker.tsx +38 -17
  59. package/src/MapMarkerNativeComponent.ts +3 -2
  60. package/src/MapOverlay.tsx +10 -10
  61. package/src/MapPolygon.tsx +6 -6
  62. package/src/MapPolygon.types.ts +2 -2
  63. package/src/MapPolyline.tsx +5 -5
  64. package/src/MapUrlTile.tsx +4 -4
  65. package/src/MapView.tsx +34 -37
  66. package/src/MapView.types.ts +2 -3
  67. package/src/MapViewNativeComponent.ts +3 -3
  68. package/src/MapWMSTile.tsx +4 -4
  69. package/src/createFabricMap.tsx +39 -37
  70. package/src/decorateMapComponent.ts +9 -3
  71. package/src/fixImageProp.ts +1 -1
  72. package/src/index.ts +1 -1
  73. package/src/sharedTypes.ts +1 -1
  74. package/src/specs/NativeAirMapsModule.ts +1 -1
  75. package/src/specs/NativeComponentCallout.ts +1 -1
  76. package/src/specs/NativeComponentCircle.ts +3 -2
  77. package/src/specs/NativeComponentGoogleMapView.ts +12 -10
  78. package/src/specs/NativeComponentGooglePolygon.ts +12 -1
  79. package/src/specs/NativeComponentMapView.ts +12 -10
  80. package/src/specs/NativeComponentMarker.ts +26 -2
  81. package/src/specs/NativeComponentOverlay.ts +1 -1
  82. package/src/specs/NativeComponentPolyline.ts +2 -2
  83. package/src/specs/NativeComponentUrlTile.ts +4 -1
  84. package/src/specs/NativeComponentWMSTile.ts +4 -1
  85. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +0 -98
  86. package/ios/AirMaps.xcodeproj/project.pbxproj +0 -627
@@ -4,10 +4,10 @@ import {
4
4
  NativeModules,
5
5
  Platform,
6
6
  UIManager,
7
- HostComponent,
7
+ type HostComponent,
8
8
  } from 'react-native';
9
9
  import {PROVIDER_DEFAULT, PROVIDER_GOOGLE} from './ProviderConstants';
10
- import {Provider} from './sharedTypes';
10
+ import type {Provider} from './sharedTypes';
11
11
  import {MapCallout} from './MapCallout';
12
12
  import {MapOverlay} from './MapOverlay';
13
13
  import {MapCalloutSubview} from './MapCalloutSubview';
@@ -23,7 +23,7 @@ import {Commands} from './MapViewNativeComponent';
23
23
  import GooglePolygon from './specs/NativeComponentGooglePolygon';
24
24
  import FabricMarker from './specs/NativeComponentMarker';
25
25
  import FabricUrlTile from './specs/NativeComponentUrlTile';
26
- import FabricWMSTile from './specs/NativeComponentWMSTile.ts';
26
+ import FabricWMSTile from './specs/NativeComponentWMSTile';
27
27
  import FabricCallout from './specs/NativeComponentCallout';
28
28
  import FabricPolyline from './specs/NativeComponentPolyline';
29
29
  import FabricCircle from './specs/NativeComponentCircle';
@@ -73,6 +73,7 @@ export default function decorateMapComponent<Type extends Component>(
73
73
  const getDefaultComponent = () =>
74
74
  requireNativeComponent(getNativeComponentName(undefined, componentName));
75
75
 
76
+ // @ts-ignore
76
77
  Component.contextType = ProviderContext;
77
78
 
78
79
  Component.prototype.getNativeComponent =
@@ -126,8 +127,13 @@ export default function decorateMapComponent<Type extends Component>(
126
127
  return components[key];
127
128
  }
128
129
 
130
+ if (!provider) {
131
+ throw new Error('react-native-maps: provider is not set');
132
+ }
133
+
129
134
  // @ts-ignore
130
135
  const providerInfo = providers[provider];
136
+
131
137
  // quick fix. Previous code assumed android | ios
132
138
  if (Platform.OS !== 'android' && Platform.OS !== 'ios') {
133
139
  throw new Error(`react-native-maps doesn't support ${Platform.OS}`);
@@ -1,4 +1,4 @@
1
- import {Image, ImageSourcePropType} from 'react-native';
1
+ import {Image, type ImageSourcePropType} from 'react-native';
2
2
 
3
3
  export function fixImageProp(
4
4
  image: ImageSourcePropType,
package/src/index.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  import MapView, {
2
2
  AnimatedMapView as Animated,
3
3
  MAP_TYPES,
4
- MapViewProps,
4
+ type MapViewProps,
5
5
  } from './MapView';
6
6
 
7
7
  import Marker from './MapMarker';
@@ -1,4 +1,4 @@
1
- import {NativeSyntheticEvent} from 'react-native';
1
+ import type {NativeSyntheticEvent} from 'react-native';
2
2
 
3
3
  export type Provider = 'google' | undefined;
4
4
 
@@ -2,7 +2,7 @@ import type {TurboModule} from 'react-native';
2
2
  import {TurboModuleRegistry} from 'react-native';
3
3
  import type {Double} from 'react-native/Libraries/Types/CodegenTypes';
4
4
  import type {Camera} from './NativeComponentMapView';
5
- import {Address} from '../MapView.types';
5
+ import type {Address} from '../MapView.types';
6
6
 
7
7
  type LatLng = {
8
8
  latitude: Double;
@@ -1,7 +1,7 @@
1
1
  import type {HostComponent, ViewProps} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {
4
+ import type {
5
5
  Double,
6
6
  BubblingEventHandler,
7
7
  } from 'react-native/Libraries/Types/CodegenTypes';
@@ -1,10 +1,11 @@
1
1
  import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {
4
+ import type {
5
5
  Double,
6
6
  Float,
7
7
  BubblingEventHandler,
8
+ WithDefault,
8
9
  } from 'react-native/Libraries/Types/CodegenTypes';
9
10
 
10
11
  export type LatLng = Readonly<{
@@ -77,7 +78,7 @@ export interface CircleFabricNativeProps extends ViewProps {
77
78
  * @platform iOS: Supported
78
79
  * @platform Android: Supported
79
80
  */
80
- strokeWidth?: Float;
81
+ strokeWidth?: WithDefault<Float, 1.0>;
81
82
 
82
83
  /**
83
84
  * Boolean to allow a polygon to be tappable and use the onPress function.
@@ -1,8 +1,9 @@
1
+ // @ts-nocheck
1
2
  import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
3
 
3
4
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
5
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
- import {
6
+ import type {
6
7
  Double,
7
8
  Int32,
8
9
  WithDefault,
@@ -10,6 +11,7 @@ import {
10
11
  DirectEventHandler,
11
12
  BubblingEventHandler,
12
13
  } from 'react-native/Libraries/Types/CodegenTypes';
14
+ import GoogleMapView from './NativeComponentGoogleMapView';
13
15
 
14
16
  export type EdgePadding = Readonly<{
15
17
  top: Double; // Non-nullable Double for top
@@ -305,7 +307,7 @@ export type RegionChangeEvent = Readonly<{
305
307
  latitudeDelta: Double; // Non-nullable Double for latitudeDelta
306
308
  longitudeDelta: Double; // Non-nullable Double for longitudeDelta
307
309
  }; // The region object
308
- continuous?: boolean;
310
+ isGesture?: boolean;
309
311
  }>;
310
312
 
311
313
  export type RegionChangeEventHandler = BubblingEventHandler<RegionChangeEvent>;
@@ -859,45 +861,45 @@ export interface MapFabricNativeProps extends ViewProps {
859
861
  zoomTapEnabled?: WithDefault<boolean, true>;
860
862
  }
861
863
 
862
- export interface NativeCommands {
864
+ interface NativeCommands {
863
865
  animateToRegion: (
864
- viewRef: React.ElementRef<React.ComponentType>,
866
+ viewRef: React.ElementRef<typeof GoogleMapView>,
865
867
  regionJSON: string,
866
868
  duration: Int32,
867
869
  ) => void;
868
870
 
869
871
  setCamera: (
870
- viewRef: React.ElementRef<React.ComponentType>,
872
+ viewRef: React.ElementRef<typeof GoogleMapView>,
871
873
  cameraJSON: string,
872
874
  ) => void;
873
875
 
874
876
  animateCamera: (
875
- viewRef: React.ElementRef<React.ComponentType>,
877
+ viewRef: React.ElementRef<typeof GoogleMapView>,
876
878
  cameraJSON: string,
877
879
  duration: Int32,
878
880
  ) => void;
879
881
 
880
882
  fitToElements: (
881
- viewRef: React.ElementRef<React.ComponentType>,
883
+ viewRef: React.ElementRef<typeof GoogleMapView>,
882
884
  edgePaddingJSON: string,
883
885
  animated: boolean,
884
886
  ) => void;
885
887
 
886
888
  fitToSuppliedMarkers: (
887
- viewRef: React.ElementRef<React.ComponentType>,
889
+ viewRef: React.ElementRef<typeof GoogleMapView>,
888
890
  markersJSON: string,
889
891
  edgePaddingJSON: string,
890
892
  animated: boolean,
891
893
  ) => void;
892
894
 
893
895
  fitToCoordinates: (
894
- viewRef: React.ElementRef<React.ComponentType>,
896
+ viewRef: React.ElementRef<typeof GoogleMapView>,
895
897
  coordinatesJSON: string,
896
898
  edgePaddingJSON: string,
897
899
  animated: boolean,
898
900
  ) => void;
899
901
  setIndoorActiveLevelIndex: (
900
- viewRef: React.ElementRef<React.ComponentType>,
902
+ viewRef: React.ElementRef<typeof GoogleMapView>,
901
903
  activeLevelIndex: Int32,
902
904
  ) => void;
903
905
  }
@@ -1,9 +1,11 @@
1
1
  import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {
4
+ import type {
5
5
  Double,
6
6
  BubblingEventHandler,
7
+ Float,
8
+ WithDefault,
7
9
  } from 'react-native/Libraries/Types/CodegenTypes';
8
10
 
9
11
  export type LatLng = Readonly<{
@@ -53,6 +55,15 @@ export interface PolygonFabricNativeProps extends ViewProps {
53
55
  */
54
56
  strokeColor?: ColorValue;
55
57
 
58
+ /**
59
+ * The stroke width to use for the path.
60
+ *
61
+ * @default 1
62
+ * @platform iOS: Supported
63
+ * @platform Android: Supported
64
+ */
65
+ strokeWidth?: WithDefault<Float, 1.0>;
66
+
56
67
  /**
57
68
  * Boolean to indicate whether to draw each segment of the line as a geodesic as opposed to straight lines on the Mercator projection.
58
69
  * A geodesic is the shortest path between two points on the Earth's surface.
@@ -1,8 +1,9 @@
1
+ // @ts-nocheck
1
2
  import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
3
 
3
4
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
5
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
5
- import {
6
+ import type {
6
7
  Double,
7
8
  Int32,
8
9
  WithDefault,
@@ -10,6 +11,7 @@ import {
10
11
  DirectEventHandler,
11
12
  BubblingEventHandler,
12
13
  } from 'react-native/Libraries/Types/CodegenTypes';
14
+ import FabricMapView from './NativeComponentMapView';
13
15
 
14
16
  export type EdgePadding = Readonly<{
15
17
  top: Double; // Non-nullable Double for top
@@ -299,7 +301,7 @@ export type RegionChangeEvent = Readonly<{
299
301
  latitudeDelta: Double; // Non-nullable Double for latitudeDelta
300
302
  longitudeDelta: Double; // Non-nullable Double for longitudeDelta
301
303
  }; // The region object
302
- continuous?: boolean;
304
+ isGesture?: boolean;
303
305
  }>;
304
306
  export type UserLocationChangeEvent = Readonly<{
305
307
  coordinate?: {
@@ -1038,46 +1040,46 @@ export interface MapFabricNativeProps extends ViewProps {
1038
1040
  cameraZoomRange?: CameraZoomRange;
1039
1041
  }
1040
1042
 
1041
- export interface NativeCommands {
1043
+ interface NativeCommands {
1042
1044
  animateToRegion: (
1043
- viewRef: React.ElementRef<React.ComponentType>,
1045
+ viewRef: React.ElementRef<typeof FabricMapView>,
1044
1046
  regionJSON: string,
1045
1047
  duration: Int32,
1046
1048
  ) => void;
1047
1049
 
1048
1050
  setCamera: (
1049
- viewRef: React.ElementRef<React.ComponentType>,
1051
+ viewRef: React.ElementRef<typeof FabricMapView>,
1050
1052
  cameraJSON: string,
1051
1053
  ) => void;
1052
1054
 
1053
1055
  animateCamera: (
1054
- viewRef: React.ElementRef<React.ComponentType>,
1056
+ viewRef: React.ElementRef<typeof FabricMapView>,
1055
1057
  cameraJSON: string,
1056
1058
  duration: Int32,
1057
1059
  ) => void;
1058
1060
 
1059
1061
  fitToElements: (
1060
- viewRef: React.ElementRef<React.ComponentType>,
1062
+ viewRef: React.ElementRef<typeof FabricMapView>,
1061
1063
  edgePaddingJSON: string,
1062
1064
  animated: boolean,
1063
1065
  ) => void;
1064
1066
 
1065
1067
  fitToSuppliedMarkers: (
1066
- viewRef: React.ElementRef<React.ComponentType>,
1068
+ viewRef: React.ElementRef<typeof FabricMapView>,
1067
1069
  markersJSON: string,
1068
1070
  edgePaddingJSON: string,
1069
1071
  animated: boolean,
1070
1072
  ) => void;
1071
1073
 
1072
1074
  fitToCoordinates: (
1073
- viewRef: React.ElementRef<React.ComponentType>,
1075
+ viewRef: React.ElementRef<typeof FabricMapView>,
1074
1076
  coordinatesJSON: string,
1075
1077
  edgePaddingJSON: string,
1076
1078
  animated: boolean,
1077
1079
  ) => void;
1078
1080
 
1079
1081
  setIndoorActiveLevelIndex: (
1080
- viewRef: React.ElementRef<React.ComponentType>,
1082
+ viewRef: React.ElementRef<typeof FabricMapView>,
1081
1083
  activeLevelIndex: Int32,
1082
1084
  ) => void;
1083
1085
  }
@@ -1,4 +1,5 @@
1
- import {HostComponent} from 'react-native';
1
+ // @ts-nocheck
2
+ import type {HostComponent} from 'react-native';
2
3
  import type {
3
4
  ViewProps,
4
5
  ColorValue,
@@ -7,7 +8,7 @@ import type {
7
8
 
8
9
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
9
10
  import codegenNativeCommands from 'react-native/Libraries/Utilities/codegenNativeCommands';
10
- import {
11
+ import type {
11
12
  Int32,
12
13
  Double,
13
14
  BubblingEventHandler,
@@ -132,6 +133,19 @@ export interface MarkerFabricNativeProps extends ViewProps {
132
133
  */
133
134
  displayPriority?: WithDefault<AppleMarkerPriority, 'required'>;
134
135
 
136
+ /**
137
+ * The offset (in points) at which to display the annotation view.
138
+ *
139
+ * By default, the center point of an annotation view is placed at the coordinate point of the associated annotation.
140
+ *
141
+ * Positive offset values move the annotation view down and to the right, while negative values move it up and to the left.
142
+ *
143
+ * @default {x: 0.0, y: 0.0}
144
+ * @platform iOS: Apple Maps only. For Google Maps, see the `anchor` prop
145
+ * @platform Android: Not supported. see the `anchor` prop
146
+ */
147
+ centerOffset?: Point;
148
+
135
149
  /**
136
150
  * The coordinate for the marker.
137
151
  *
@@ -173,6 +187,16 @@ export interface MarkerFabricNativeProps extends ViewProps {
173
187
  */
174
188
  title?: string;
175
189
 
190
+ /**
191
+ * Sets whether this marker should track view changes.
192
+ * It's recommended to turn it off whenever it's possible to improve custom marker performance.
193
+ *
194
+ * @default true
195
+ * @platform iOS: Google Maps only
196
+ * @platform Android: Supported
197
+ */
198
+ tracksViewChanges?: WithDefault<boolean, true>;
199
+
176
200
  /**
177
201
  * A string that can be used to identify this marker.
178
202
  *
@@ -1,5 +1,5 @@
1
1
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
2
- import {
2
+ import type {
3
3
  Double,
4
4
  Float,
5
5
  BubblingEventHandler,
@@ -1,7 +1,7 @@
1
1
  import type {HostComponent, ViewProps, ColorValue} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {
4
+ import type {
5
5
  Double,
6
6
  Float,
7
7
  BubblingEventHandler,
@@ -107,7 +107,7 @@ export interface PolylineFabricNativeProps extends ViewProps {
107
107
  * @platform iOS: Supported
108
108
  * @platform Android: Supported
109
109
  */
110
- strokeWidth?: Float;
110
+ strokeWidth?: WithDefault<Float, 1.0>;
111
111
 
112
112
  /**
113
113
  * Boolean to allow a polygon to be tappable and use the onPress function.
@@ -1,7 +1,10 @@
1
1
  import type {HostComponent, ViewProps} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
4
+ import type {
5
+ Int32,
6
+ WithDefault,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
5
8
 
6
9
  export interface UrlTileFabricNativeProps extends ViewProps {
7
10
  /**
@@ -1,7 +1,10 @@
1
1
  import type {HostComponent, ViewProps} from 'react-native';
2
2
 
3
3
  import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
- import {Int32, WithDefault} from 'react-native/Libraries/Types/CodegenTypes';
4
+ import type {
5
+ Int32,
6
+ WithDefault,
7
+ } from 'react-native/Libraries/Types/CodegenTypes';
5
8
 
6
9
  export interface WMSTileFabricNativeProps extends ViewProps {
7
10
  /**
@@ -1,98 +0,0 @@
1
- package com.rnmaps.maps;
2
-
3
- import androidx.annotation.NonNull;
4
-
5
- import com.facebook.react.TurboReactPackage;
6
- import com.facebook.react.bridge.NativeModule;
7
- import com.facebook.react.bridge.ReactApplicationContext;
8
- import com.facebook.react.module.model.ReactModuleInfo;
9
- import com.facebook.react.module.model.ReactModuleInfoProvider;
10
- import com.facebook.react.uimanager.ViewManager;
11
- import com.facebook.fbreact.specs.NativeAirMapsModuleSpec;
12
- import com.rnmaps.fabric.CalloutManager;
13
- import com.rnmaps.fabric.CircleManager;
14
- import com.rnmaps.fabric.MapViewManager;
15
- import com.rnmaps.fabric.MarkerManager;
16
- import com.rnmaps.fabric.NativeAirMapsModule;
17
- import com.rnmaps.fabric.OverlayManager;
18
- import com.rnmaps.fabric.PolygonManager;
19
- import com.rnmaps.fabric.PolylineManager;
20
- import com.rnmaps.fabric.UrlTileManager;
21
- import com.rnmaps.fabric.WMSTileManager;
22
-
23
- import java.util.HashMap;
24
- import java.util.List;
25
- import java.util.Map;
26
-
27
- public class MapAirModulePackage extends TurboReactPackage {
28
-
29
- @Override
30
- public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
31
- return List.of(new MapViewManager(reactContext),
32
- new MarkerManager(reactContext),
33
- new CalloutManager(reactContext),
34
- new PolygonManager(reactContext),
35
- new PolylineManager(reactContext),
36
- new CircleManager(reactContext),
37
- new OverlayManager(reactContext),
38
- new UrlTileManager(reactContext),
39
- new WMSTileManager(reactContext));
40
- }
41
-
42
-
43
- @Override
44
- public NativeModule getModule(String name, ReactApplicationContext reactContext) {
45
- if (OverlayManager.REACT_CLASS.equals(name)) {
46
- return new OverlayManager(reactContext);
47
- }
48
- if (CircleManager.REACT_CLASS.equals(name)) {
49
- return new CircleManager(reactContext);
50
- }
51
- if (PolylineManager.REACT_CLASS.equals(name)) {
52
- return new PolylineManager(reactContext);
53
- }
54
- if (PolygonManager.REACT_CLASS.equals(name)) {
55
- return new PolygonManager(reactContext);
56
- }
57
- if (CalloutManager.REACT_CLASS.equals(name)) {
58
- return new CalloutManager(reactContext);
59
- }
60
- if (MarkerManager.REACT_CLASS.equals(name)) {
61
- return new MarkerManager(reactContext);
62
- }
63
- if (MapViewManager.REACT_CLASS.equals(name)) {
64
- return new MapViewManager(reactContext);
65
- }
66
- if (UrlTileManager.REACT_CLASS.equals(name)) {
67
- return new UrlTileManager(reactContext);
68
- }
69
- if (WMSTileManager.REACT_CLASS.equals(name)) {
70
- return new WMSTileManager(reactContext);
71
- }
72
- if (NativeAirMapsModuleSpec.NAME.equals(name)) {
73
- return new NativeAirMapsModule(reactContext);
74
- } else {
75
- return null;
76
- }
77
- }
78
-
79
- @Override
80
- public ReactModuleInfoProvider getReactModuleInfoProvider() {
81
- return new ReactModuleInfoProvider() {
82
- @NonNull
83
- @Override
84
- public Map<String, ReactModuleInfo> getReactModuleInfos() {
85
- Map<String, ReactModuleInfo> map = new HashMap<>();
86
- map.put(NativeAirMapsModuleSpec.NAME, new ReactModuleInfo(
87
- NativeAirMapsModuleSpec.NAME, // name
88
- NativeAirMapsModuleSpec.NAME, // className
89
- false, // canOverrideExistingModule
90
- false, // needsEagerInit
91
- false, // isCXXModule
92
- true // isTurboModule
93
- ));
94
- return map;
95
- }
96
- };
97
- }
98
- }