react-native-maps 1.21.0-alpha.81 → 1.21.0-alpha.83

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 (39) hide show
  1. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerDelegate.java +49 -0
  2. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsCircleManagerInterface.java +24 -0
  3. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerDelegate.java +46 -0
  4. package/android/generated/java/com/facebook/react/viewmanagers/RNMapsOverlayManagerInterface.java +24 -0
  5. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
  6. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +2 -0
  7. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +44 -0
  8. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +44 -0
  9. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +23 -0
  10. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +81 -0
  11. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +2 -0
  12. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +22 -0
  13. package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +24 -0
  14. package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
  15. package/android/src/main/java/com/rnmaps/fabric/MapViewManager.java +5 -0
  16. package/android/src/main/java/com/rnmaps/fabric/MarkerManager.java +0 -1
  17. package/android/src/main/java/com/rnmaps/fabric/OverlayManager.java +94 -0
  18. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +9 -1
  19. package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
  20. package/android/src/main/java/com/rnmaps/maps/MapOverlay.java +175 -3
  21. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +2 -0
  22. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +2 -0
  23. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +44 -0
  24. package/ios/generated/RNMapsSpecs/EventEmitters.h +44 -0
  25. package/ios/generated/RNMapsSpecs/Props.cpp +23 -0
  26. package/ios/generated/RNMapsSpecs/Props.h +81 -0
  27. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +8 -0
  28. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +2 -0
  29. package/ios/generated/RNMapsSpecs/ShadowNodes.h +22 -0
  30. package/ios/generated/RNMapsSpecs/States.h +24 -0
  31. package/lib/MapMarker.js +6 -1
  32. package/lib/MapOverlay.d.ts +1 -0
  33. package/lib/MapOverlay.js +23 -4
  34. package/lib/decorateMapComponent.js +10 -0
  35. package/lib/specs/NativeComponentCircle.d.ts +74 -0
  36. package/lib/specs/NativeComponentCircle.js +7 -0
  37. package/lib/specs/NativeComponentOverlay.d.ts +67 -0
  38. package/lib/specs/NativeComponentOverlay.js +7 -0
  39. package/package.json +1 -1
@@ -13,6 +13,10 @@
13
13
 
14
14
  NS_ASSUME_NONNULL_BEGIN
15
15
 
16
+ @protocol RCTRNMapsCircleViewProtocol <NSObject>
17
+
18
+ @end
19
+
16
20
  @protocol RCTRNMapsGoogleMapViewViewProtocol <NSObject>
17
21
  - (void)animateToRegion:(NSString *)regionJSON duration:(NSInteger)duration;
18
22
  - (void)setCamera:(NSString *)cameraJSON;
@@ -588,6 +592,10 @@ if ([commandName isEqualToString:@"redraw"]) {
588
592
  #endif
589
593
  }
590
594
 
595
+ @protocol RCTRNMapsOverlayViewProtocol <NSObject>
596
+
597
+ @end
598
+
591
599
  @protocol RCTRNMapsPolylineViewProtocol <NSObject>
592
600
 
593
601
  @end
@@ -13,10 +13,12 @@
13
13
  namespace facebook::react {
14
14
 
15
15
  extern const char RNMapsCalloutComponentName[] = "RNMapsCallout";
16
+ extern const char RNMapsCircleComponentName[] = "RNMapsCircle";
16
17
  extern const char RNMapsGoogleMapViewComponentName[] = "RNMapsGoogleMapView";
17
18
  extern const char RNMapsGooglePolygonComponentName[] = "RNMapsGooglePolygon";
18
19
  extern const char RNMapsMapViewComponentName[] = "RNMapsMapView";
19
20
  extern const char RNMapsMarkerComponentName[] = "RNMapsMarker";
21
+ extern const char RNMapsOverlayComponentName[] = "RNMapsOverlay";
20
22
  extern const char RNMapsPolylineComponentName[] = "RNMapsPolyline";
21
23
 
22
24
  } // namespace facebook::react
@@ -29,6 +29,17 @@ using RNMapsCalloutShadowNode = ConcreteViewShadowNode<
29
29
  RNMapsCalloutEventEmitter,
30
30
  RNMapsCalloutState>;
31
31
 
32
+ JSI_EXPORT extern const char RNMapsCircleComponentName[];
33
+
34
+ /*
35
+ * `ShadowNode` for <RNMapsCircle> component.
36
+ */
37
+ using RNMapsCircleShadowNode = ConcreteViewShadowNode<
38
+ RNMapsCircleComponentName,
39
+ RNMapsCircleProps,
40
+ RNMapsCircleEventEmitter,
41
+ RNMapsCircleState>;
42
+
32
43
  JSI_EXPORT extern const char RNMapsGoogleMapViewComponentName[];
33
44
 
34
45
  /*
@@ -73,6 +84,17 @@ using RNMapsMarkerShadowNode = ConcreteViewShadowNode<
73
84
  RNMapsMarkerEventEmitter,
74
85
  RNMapsMarkerState>;
75
86
 
87
+ JSI_EXPORT extern const char RNMapsOverlayComponentName[];
88
+
89
+ /*
90
+ * `ShadowNode` for <RNMapsOverlay> component.
91
+ */
92
+ using RNMapsOverlayShadowNode = ConcreteViewShadowNode<
93
+ RNMapsOverlayComponentName,
94
+ RNMapsOverlayProps,
95
+ RNMapsOverlayEventEmitter,
96
+ RNMapsOverlayState>;
97
+
76
98
  JSI_EXPORT extern const char RNMapsPolylineComponentName[];
77
99
 
78
100
  /*
@@ -26,6 +26,18 @@ public:
26
26
  #endif
27
27
  };
28
28
 
29
+ class RNMapsCircleState {
30
+ public:
31
+ RNMapsCircleState() = default;
32
+
33
+ #ifdef ANDROID
34
+ RNMapsCircleState(RNMapsCircleState const &previousState, folly::dynamic data){};
35
+ folly::dynamic getDynamic() const {
36
+ return {};
37
+ };
38
+ #endif
39
+ };
40
+
29
41
  class RNMapsGoogleMapViewState {
30
42
  public:
31
43
  RNMapsGoogleMapViewState() = default;
@@ -74,6 +86,18 @@ public:
74
86
  #endif
75
87
  };
76
88
 
89
+ class RNMapsOverlayState {
90
+ public:
91
+ RNMapsOverlayState() = default;
92
+
93
+ #ifdef ANDROID
94
+ RNMapsOverlayState(RNMapsOverlayState const &previousState, folly::dynamic data){};
95
+ folly::dynamic getDynamic() const {
96
+ return {};
97
+ };
98
+ #endif
99
+ };
100
+
77
101
  class RNMapsPolylineState {
78
102
  public:
79
103
  RNMapsPolylineState() = default;
package/lib/MapMarker.js CHANGED
@@ -127,7 +127,12 @@ class MapMarker extends React.Component {
127
127
  let image;
128
128
  if (this.props.image) {
129
129
  if (this.fabricMarker) {
130
- image = this.props.image;
130
+ if (typeof this.props.image === 'string') {
131
+ image = { uri: this.props.image };
132
+ }
133
+ else {
134
+ image = this.props.image;
135
+ }
131
136
  }
132
137
  else {
133
138
  const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
@@ -60,6 +60,7 @@ export declare class MapOverlay extends React.Component<MapOverlayProps> {
60
60
  getMapManagerCommand: (name: string) => MapManagerCommand;
61
61
  getUIManagerCommand: (name: string) => UIManagerCommand;
62
62
  static Animated: Animated.AnimatedComponent<typeof MapOverlay>;
63
+ private fabricOverlay?;
63
64
  render(): React.JSX.Element;
64
65
  }
65
66
  type Coordinate = [number, number];
package/lib/MapOverlay.js CHANGED
@@ -32,13 +32,32 @@ class MapOverlay extends React.Component {
32
32
  getMapManagerCommand;
33
33
  getUIManagerCommand;
34
34
  static Animated;
35
+ fabricOverlay = undefined;
35
36
  render() {
36
37
  const { opacity = 1.0 } = this.props;
37
- let image;
38
- const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
39
- image = resolvedImage.uri || this.props.image;
38
+ if (this.fabricOverlay === undefined) {
39
+ this.fabricOverlay = react_native_1.Platform.OS === 'android';
40
+ }
40
41
  const AIRMapOverlay = this.getNativeComponent();
41
- return (<AIRMapOverlay {...this.props} opacity={opacity} image={image} style={[styles.overlay, this.props.style]}/>);
42
+ let image;
43
+ if (this.props.image) {
44
+ if (this.fabricOverlay) {
45
+ if (typeof this.props.image === 'string') {
46
+ image = { uri: this.props.image };
47
+ }
48
+ else {
49
+ image = this.props.image;
50
+ }
51
+ }
52
+ else {
53
+ const resolvedImage = react_native_1.Image.resolveAssetSource(this.props.image) || {};
54
+ image = resolvedImage.uri || this.props.image;
55
+ }
56
+ }
57
+ console.log('MapOverlay image: ' + image);
58
+ return (<AIRMapOverlay {...this.props} opacity={opacity}
59
+ // @ts-ignore
60
+ image={image} style={[styles.overlay, this.props.style]}/>);
42
61
  }
43
62
  }
44
63
  exports.MapOverlay = MapOverlay;
@@ -11,6 +11,8 @@ const NativeComponentGooglePolygon_1 = __importDefault(require("./specs/NativeCo
11
11
  const NativeComponentMarker_1 = __importDefault(require("./specs/NativeComponentMarker"));
12
12
  const NativeComponentCallout_1 = __importDefault(require("./specs/NativeComponentCallout"));
13
13
  const NativeComponentPolyline_1 = __importDefault(require("./specs/NativeComponentPolyline"));
14
+ const NativeComponentCircle_1 = __importDefault(require("./specs/NativeComponentCircle"));
15
+ const NativeComponentOverlay_1 = __importDefault(require("./specs/NativeComponentOverlay"));
14
16
  exports.SUPPORTED = 'SUPPORTED';
15
17
  exports.USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
16
18
  exports.NOT_SUPPORTED = 'NOT_SUPPORTED';
@@ -63,6 +65,14 @@ function decorateMapComponent(Component, componentName, providers) {
63
65
  // @ts-ignore
64
66
  return NativeComponentPolyline_1.default;
65
67
  }
68
+ else if (componentName === 'Circle') {
69
+ // @ts-ignore
70
+ return NativeComponentCircle_1.default;
71
+ }
72
+ else if (componentName === 'Overlay') {
73
+ // @ts-ignore
74
+ return NativeComponentOverlay_1.default;
75
+ }
66
76
  }
67
77
  const key = provider || 'default';
68
78
  if (components[key]) {
@@ -0,0 +1,74 @@
1
+ import type { HostComponent, ViewProps, ColorValue } from 'react-native';
2
+ import { Double, Float, BubblingEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ export type LatLng = Readonly<{
4
+ latitude: Double;
5
+ longitude: Double;
6
+ }>;
7
+ export type CirclePressEventHandler = BubblingEventHandler<Readonly<{
8
+ action?: string;
9
+ id: string;
10
+ coordinate: {
11
+ latitude: Double;
12
+ longitude: Double;
13
+ };
14
+ position?: {
15
+ x: Double;
16
+ y: Double;
17
+ };
18
+ }>>;
19
+ export interface CircleFabricNativeProps extends ViewProps {
20
+ /**
21
+ * The coordinates of the center of the circle.
22
+ *
23
+ * @platform iOS: Supported
24
+ * @platform Android: Supported
25
+ */
26
+ center: LatLng;
27
+ /**
28
+ * The stroke color to use for the path.
29
+ *
30
+ * @default `#000`, `rgba(r,g,b,0.5)`
31
+ * @platform iOS: Supported
32
+ * @platform Android: Supported
33
+ */
34
+ fillColor?: ColorValue;
35
+ /**
36
+ * The radius of the circle to be drawn (in meters)
37
+ *
38
+ * @platform iOS: Supported
39
+ * @platform Android: Supported
40
+ */
41
+ radius: Double;
42
+ /**
43
+ * The stroke color to use for the path.
44
+ *
45
+ * @default `#000`, `rgba(r,g,b,0.5)`
46
+ * @platform iOS: Supported
47
+ * @platform Android: Supported
48
+ */
49
+ strokeColor?: ColorValue;
50
+ /**
51
+ * Callback that is called when user taps on the map.
52
+ *
53
+ * @platform iOS: Supported
54
+ * @platform Android: Supported
55
+ */
56
+ onPress?: CirclePressEventHandler;
57
+ /**
58
+ * The stroke width to use for the path.
59
+ *
60
+ * @default 1
61
+ * @platform iOS: Supported
62
+ * @platform Android: Supported
63
+ */
64
+ strokeWidth?: Float;
65
+ /**
66
+ * Boolean to allow a polygon to be tappable and use the onPress function.
67
+ *
68
+ * @platform iOS: Google Maps only
69
+ * @platform Android: Supported
70
+ */
71
+ tappable?: boolean;
72
+ }
73
+ declare const _default: HostComponent<CircleFabricNativeProps>;
74
+ export default _default;
@@ -0,0 +1,7 @@
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
+ const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
7
+ exports.default = (0, codegenNativeComponent_1.default)('RNMapsCircle', {});
@@ -0,0 +1,67 @@
1
+ import { Double, Float, BubblingEventHandler, WithDefault } from 'react-native/Libraries/Types/CodegenTypes';
2
+ import type { ViewProps, HostComponent, ImageSourcePropType as ImageSource } from 'react-native';
3
+ export type LatLng = Readonly<{
4
+ latitude: Double;
5
+ longitude: Double;
6
+ }>;
7
+ export type OverlayPressEventHandler = BubblingEventHandler<Readonly<{
8
+ action?: string;
9
+ id: string;
10
+ coordinate: {
11
+ latitude: Double;
12
+ longitude: Double;
13
+ };
14
+ position?: {
15
+ x: Double;
16
+ y: Double;
17
+ };
18
+ }>>;
19
+ export interface OverlayFabricNativeProps extends ViewProps {
20
+ /**
21
+ * The bearing in degrees clockwise from north. Values outside the range [0, 360) will be normalized.
22
+ *
23
+ * @default 0
24
+ * @platform iOS: Google Maps only
25
+ * @platform Android: Supported
26
+ */
27
+ bearing?: Float;
28
+ /**
29
+ * The coordinates for the image (left-top corner, right-bottom corner). ie.```[[lat, long], [lat, long]]```
30
+ *
31
+ * @platform iOS: Supported
32
+ * @platform Android: Supported
33
+ */
34
+ bounds: ReadonlyArray<LatLng>;
35
+ /**
36
+ * A custom image to be used as the overlay.
37
+ * Only required local image resources and uri (as for images located in the net) are allowed to be used.
38
+ *
39
+ * @platform iOS: Supported
40
+ * @platform Android: Supported
41
+ */
42
+ image?: ImageSource | null;
43
+ /**
44
+ * Callback that is called when user taps on the map.
45
+ *
46
+ * @platform iOS: Supported
47
+ * @platform Android: Supported
48
+ */
49
+ onPress?: OverlayPressEventHandler;
50
+ /**
51
+ * The overlay's opacity between 0.0 and 1.0.
52
+ *
53
+ * @default 1.0
54
+ * @platform iOS: Supported
55
+ * @platform Android: Supported
56
+ */
57
+ opacity?: WithDefault<Float, 1.0>;
58
+ /**
59
+ * Boolean to allow a polygon to be tappable and use the onPress function.
60
+ *
61
+ * @platform iOS: Google Maps only
62
+ * @platform Android: Supported
63
+ */
64
+ tappable?: boolean;
65
+ }
66
+ declare const _default: HostComponent<OverlayFabricNativeProps>;
67
+ export default _default;
@@ -0,0 +1,7 @@
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
+ const codegenNativeComponent_1 = __importDefault(require("react-native/Libraries/Utilities/codegenNativeComponent"));
7
+ exports.default = (0, codegenNativeComponent_1.default)('RNMapsOverlay', {});
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "lib/index.js",
6
6
  "author": "Leland Richardson <leland.m.richardson@gmail.com>",
7
7
  "homepage": "https://github.com/react-native-maps/react-native-maps#readme",
8
- "version": "1.21.0-alpha.81",
8
+ "version": "1.21.0-alpha.83",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",