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

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 (26) hide show
  1. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.cpp +1 -0
  2. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ComponentDescriptors.h +1 -0
  3. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.cpp +22 -0
  4. package/android/generated/jni/react/renderer/components/RNMapsSpecs/EventEmitters.h +22 -0
  5. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.cpp +12 -0
  6. package/android/generated/jni/react/renderer/components/RNMapsSpecs/Props.h +36 -0
  7. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.cpp +1 -0
  8. package/android/generated/jni/react/renderer/components/RNMapsSpecs/ShadowNodes.h +11 -0
  9. package/android/generated/jni/react/renderer/components/RNMapsSpecs/States.h +12 -0
  10. package/android/src/main/java/com/rnmaps/fabric/CircleManager.java +94 -0
  11. package/android/src/main/java/com/rnmaps/maps/MapAirModulePackage.java +5 -1
  12. package/android/src/main/java/com/rnmaps/maps/MapCircle.java +24 -0
  13. package/ios/generated/RNMapsSpecs/ComponentDescriptors.cpp +1 -0
  14. package/ios/generated/RNMapsSpecs/ComponentDescriptors.h +1 -0
  15. package/ios/generated/RNMapsSpecs/EventEmitters.cpp +22 -0
  16. package/ios/generated/RNMapsSpecs/EventEmitters.h +22 -0
  17. package/ios/generated/RNMapsSpecs/Props.cpp +12 -0
  18. package/ios/generated/RNMapsSpecs/Props.h +36 -0
  19. package/ios/generated/RNMapsSpecs/RCTComponentViewHelpers.h +4 -0
  20. package/ios/generated/RNMapsSpecs/ShadowNodes.cpp +1 -0
  21. package/ios/generated/RNMapsSpecs/ShadowNodes.h +11 -0
  22. package/ios/generated/RNMapsSpecs/States.h +12 -0
  23. package/lib/decorateMapComponent.js +5 -0
  24. package/lib/specs/NativeComponentCircle.d.ts +74 -0
  25. package/lib/specs/NativeComponentCircle.js +7 -0
  26. package/package.json +1 -1
@@ -17,6 +17,7 @@ namespace facebook::react {
17
17
  void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
18
18
  std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
19
  registry->add(concreteComponentDescriptorProvider<RNMapsCalloutComponentDescriptor>());
20
+ registry->add(concreteComponentDescriptorProvider<RNMapsCircleComponentDescriptor>());
20
21
  registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDescriptor>());
21
22
  registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
22
23
  registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
@@ -17,6 +17,7 @@
17
17
  namespace facebook::react {
18
18
 
19
19
  using RNMapsCalloutComponentDescriptor = ConcreteComponentDescriptor<RNMapsCalloutShadowNode>;
20
+ using RNMapsCircleComponentDescriptor = ConcreteComponentDescriptor<RNMapsCircleShadowNode>;
20
21
  using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMapViewShadowNode>;
21
22
  using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
22
23
  using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
@@ -35,6 +35,28 @@ $payload.setProperty(runtime, "id", $event.id);
35
35
  }
36
36
 
37
37
 
38
+ void RNMapsCircleEventEmitter::onPress(OnPress $event) const {
39
+ dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
40
+ auto $payload = jsi::Object(runtime);
41
+ $payload.setProperty(runtime, "action", $event.action);
42
+ $payload.setProperty(runtime, "id", $event.id);
43
+ {
44
+ auto coordinate = jsi::Object(runtime);
45
+ coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
46
+ coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
47
+ $payload.setProperty(runtime, "coordinate", coordinate);
48
+ }
49
+ {
50
+ auto position = jsi::Object(runtime);
51
+ position.setProperty(runtime, "x", $event.position.x);
52
+ position.setProperty(runtime, "y", $event.position.y);
53
+ $payload.setProperty(runtime, "position", position);
54
+ }
55
+ return $payload;
56
+ });
57
+ }
58
+
59
+
38
60
  void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFocused $event) const {
39
61
  dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
40
62
  auto $payload = jsi::Object(runtime);
@@ -35,6 +35,28 @@ class RNMapsCalloutEventEmitter : public ViewEventEmitter {
35
35
  };
36
36
  void onPress(OnPress value) const;
37
37
  };
38
+ class RNMapsCircleEventEmitter : public ViewEventEmitter {
39
+ public:
40
+ using ViewEventEmitter::ViewEventEmitter;
41
+
42
+ struct OnPressCoordinate {
43
+ double latitude;
44
+ double longitude;
45
+ };
46
+
47
+ struct OnPressPosition {
48
+ double x;
49
+ double y;
50
+ };
51
+
52
+ struct OnPress {
53
+ std::string action;
54
+ std::string id;
55
+ OnPressCoordinate coordinate;
56
+ OnPressPosition position;
57
+ };
58
+ void onPress(OnPress value) const;
59
+ };
38
60
  class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
39
61
  public:
40
62
  using ViewEventEmitter::ViewEventEmitter;
@@ -23,6 +23,18 @@ RNMapsCalloutProps::RNMapsCalloutProps(
23
23
  alphaHitTest(convertRawProp(context, rawProps, "alphaHitTest", sourceProps.alphaHitTest, {false})),
24
24
  tooltip(convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {false}))
25
25
  {}
26
+ RNMapsCircleProps::RNMapsCircleProps(
27
+ const PropsParserContext &context,
28
+ const RNMapsCircleProps &sourceProps,
29
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
30
+
31
+ center(convertRawProp(context, rawProps, "center", sourceProps.center, {})),
32
+ fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, {})),
33
+ radius(convertRawProp(context, rawProps, "radius", sourceProps.radius, {0.0})),
34
+ strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
35
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
36
+ tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
37
+ {}
26
38
  RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
27
39
  const PropsParserContext &context,
28
40
  const RNMapsGoogleMapViewProps &sourceProps,
@@ -29,6 +29,42 @@ class RNMapsCalloutProps final : public ViewProps {
29
29
  bool tooltip{false};
30
30
  };
31
31
 
32
+ struct RNMapsCircleCenterStruct {
33
+ double latitude{0.0};
34
+ double longitude{0.0};
35
+ };
36
+
37
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsCircleCenterStruct &result) {
38
+ auto map = (std::unordered_map<std::string, RawValue>)value;
39
+
40
+ auto tmp_latitude = map.find("latitude");
41
+ if (tmp_latitude != map.end()) {
42
+ fromRawValue(context, tmp_latitude->second, result.latitude);
43
+ }
44
+ auto tmp_longitude = map.find("longitude");
45
+ if (tmp_longitude != map.end()) {
46
+ fromRawValue(context, tmp_longitude->second, result.longitude);
47
+ }
48
+ }
49
+
50
+ static inline std::string toString(const RNMapsCircleCenterStruct &value) {
51
+ return "[Object RNMapsCircleCenterStruct]";
52
+ }
53
+ class RNMapsCircleProps final : public ViewProps {
54
+ public:
55
+ RNMapsCircleProps() = default;
56
+ RNMapsCircleProps(const PropsParserContext& context, const RNMapsCircleProps &sourceProps, const RawProps &rawProps);
57
+
58
+ #pragma mark - Props
59
+
60
+ RNMapsCircleCenterStruct center{};
61
+ SharedColor fillColor{};
62
+ double radius{0.0};
63
+ SharedColor strokeColor{};
64
+ Float strokeWidth{0.0};
65
+ bool tappable{false};
66
+ };
67
+
32
68
  enum class RNMapsGoogleMapViewMapType { Hybrid, MutedStandard, None, Satellite, Standard, Terrain, SatelliteFlyover, HybridFlyover };
33
69
 
34
70
  static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsGoogleMapViewMapType &result) {
@@ -13,6 +13,7 @@
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";
@@ -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
  /*
@@ -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;
@@ -0,0 +1,94 @@
1
+ package com.rnmaps.fabric;
2
+
3
+
4
+ import androidx.annotation.Nullable;
5
+
6
+ import com.facebook.react.bridge.ReactApplicationContext;
7
+ import com.facebook.react.bridge.ReadableMap;
8
+ import com.facebook.react.module.annotations.ReactModule;
9
+ import com.facebook.react.uimanager.ThemedReactContext;
10
+ import com.facebook.react.uimanager.ViewGroupManager;
11
+ import com.facebook.react.uimanager.ViewManagerDelegate;
12
+ import com.facebook.react.viewmanagers.RNMapsCircleManagerDelegate;
13
+ import com.facebook.react.viewmanagers.RNMapsCircleManagerInterface;
14
+ import com.rnmaps.maps.MapCircle;
15
+
16
+ import java.util.HashMap;
17
+ import java.util.Map;
18
+
19
+ @ReactModule(name = CircleManager.REACT_CLASS)
20
+ public class CircleManager extends ViewGroupManager<MapCircle> implements RNMapsCircleManagerInterface<MapCircle> {
21
+ public CircleManager(ReactApplicationContext context) {
22
+ super(context);
23
+ }
24
+
25
+ private final RNMapsCircleManagerDelegate<MapCircle, CircleManager> delegate =
26
+ new RNMapsCircleManagerDelegate<>(this);
27
+
28
+ @Override
29
+ public ViewManagerDelegate<MapCircle> getDelegate() {
30
+ return delegate;
31
+ }
32
+
33
+ @Override
34
+ public String getName() {
35
+ return REACT_CLASS;
36
+ }
37
+
38
+ @Override
39
+ public MapCircle createViewInstance(ThemedReactContext context) {
40
+ return new MapCircle(context);
41
+ }
42
+
43
+
44
+ public static final String REACT_CLASS = "RNMapsCircle";
45
+
46
+ @Nullable
47
+ @Override
48
+ public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
49
+ return MapCircle.getExportedCustomBubblingEventTypeConstants();
50
+ }
51
+
52
+ @Nullable
53
+ @Override
54
+ public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
55
+ return new HashMap<>();
56
+ }
57
+
58
+
59
+
60
+ @Override
61
+ public void setZIndex(MapCircle view, float value) {
62
+ view.setZIndex(value);
63
+ }
64
+
65
+ @Override
66
+ public void setCenter(MapCircle view, @Nullable ReadableMap value) {
67
+ view.setCenter(value);
68
+ }
69
+
70
+ @Override
71
+ public void setFillColor(MapCircle view, @Nullable Integer value) {
72
+ view.setFillColor(value);
73
+ }
74
+
75
+ @Override
76
+ public void setRadius(MapCircle view, double value) {
77
+ view.setRadius(value);
78
+ }
79
+
80
+ @Override
81
+ public void setStrokeColor(MapCircle view, @Nullable Integer value) {
82
+ view.setStrokeColor(value);
83
+ }
84
+
85
+ @Override
86
+ public void setStrokeWidth(MapCircle view, float value) {
87
+ view.setStrokeWidth(value);
88
+ }
89
+
90
+ @Override
91
+ public void setTappable(MapCircle view, boolean value) {
92
+ view.setTappable(value);
93
+ }
94
+ }
@@ -9,6 +9,7 @@ import com.facebook.react.module.model.ReactModuleInfo;
9
9
  import com.facebook.react.module.model.ReactModuleInfoProvider;
10
10
  import com.facebook.react.uimanager.ViewManager;
11
11
  import com.rnmaps.fabric.CalloutManager;
12
+ import com.rnmaps.fabric.CircleManager;
12
13
  import com.rnmaps.fabric.MapViewManager;
13
14
  import com.rnmaps.fabric.MarkerManager;
14
15
  import com.rnmaps.fabric.NativeAirMapsModule;
@@ -24,12 +25,15 @@ public class MapAirModulePackage extends TurboReactPackage {
24
25
 
25
26
  @Override
26
27
  public List<ViewManager> createViewManagers(ReactApplicationContext reactContext) {
27
- return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext), new PolygonManager(reactContext), new PolylineManager(reactContext));
28
+ return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext), new PolygonManager(reactContext), new PolylineManager(reactContext), new CircleManager(reactContext));
28
29
  }
29
30
 
30
31
 
31
32
  @Override
32
33
  public NativeModule getModule(String name, ReactApplicationContext reactContext) {
34
+ if (CircleManager.REACT_CLASS.equals(name)) {
35
+ return new CircleManager(reactContext);
36
+ }
33
37
  if (PolylineManager.REACT_CLASS.equals(name)) {
34
38
  return new PolylineManager(reactContext);
35
39
  }
@@ -2,10 +2,15 @@ package com.rnmaps.maps;
2
2
 
3
3
  import android.content.Context;
4
4
 
5
+ import com.facebook.react.bridge.ReadableMap;
6
+ import com.facebook.react.common.MapBuilder;
5
7
  import com.google.android.gms.maps.model.Circle;
6
8
  import com.google.android.gms.maps.model.CircleOptions;
7
9
  import com.google.android.gms.maps.model.LatLng;
8
10
  import com.google.maps.android.collections.CircleManager;
11
+ import com.rnmaps.fabric.event.OnPressEvent;
12
+
13
+ import java.util.Map;
9
14
 
10
15
  public class MapCircle extends MapFeature {
11
16
 
@@ -18,6 +23,7 @@ public class MapCircle extends MapFeature {
18
23
  private int fillColor;
19
24
  private float strokeWidth;
20
25
  private float zIndex;
26
+ private boolean tappable;
21
27
 
22
28
  public MapCircle(Context context) {
23
29
  super(context);
@@ -30,6 +36,12 @@ public class MapCircle extends MapFeature {
30
36
  }
31
37
  }
32
38
 
39
+ public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
40
+ MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
41
+ builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
42
+ return builder.build();
43
+ }
44
+
33
45
  public void setRadius(double radius) {
34
46
  this.radius = radius;
35
47
  if (circle != null) {
@@ -65,6 +77,13 @@ public class MapCircle extends MapFeature {
65
77
  }
66
78
  }
67
79
 
80
+ public void setTappable(boolean tappable) {
81
+ this.tappable = tappable;
82
+ if (circle != null) {
83
+ circle.setClickable(tappable);
84
+ }
85
+ }
86
+
68
87
  public CircleOptions getCircleOptions() {
69
88
  if (circleOptions == null) {
70
89
  circleOptions = createCircleOptions();
@@ -99,4 +118,9 @@ public class MapCircle extends MapFeature {
99
118
  CircleManager.Collection circleCollection = (CircleManager.Collection) collection;
100
119
  circleCollection.remove(circle);
101
120
  }
121
+
122
+
123
+ public void setCenter(ReadableMap center) {
124
+ setCenter(new LatLng(center.getDouble("latitude"), center.getDouble("longitude")));
125
+ }
102
126
  }
@@ -17,6 +17,7 @@ namespace facebook::react {
17
17
  void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
18
18
  std::shared_ptr<const ComponentDescriptorProviderRegistry> registry) {
19
19
  registry->add(concreteComponentDescriptorProvider<RNMapsCalloutComponentDescriptor>());
20
+ registry->add(concreteComponentDescriptorProvider<RNMapsCircleComponentDescriptor>());
20
21
  registry->add(concreteComponentDescriptorProvider<RNMapsGoogleMapViewComponentDescriptor>());
21
22
  registry->add(concreteComponentDescriptorProvider<RNMapsGooglePolygonComponentDescriptor>());
22
23
  registry->add(concreteComponentDescriptorProvider<RNMapsMapViewComponentDescriptor>());
@@ -17,6 +17,7 @@
17
17
  namespace facebook::react {
18
18
 
19
19
  using RNMapsCalloutComponentDescriptor = ConcreteComponentDescriptor<RNMapsCalloutShadowNode>;
20
+ using RNMapsCircleComponentDescriptor = ConcreteComponentDescriptor<RNMapsCircleShadowNode>;
20
21
  using RNMapsGoogleMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsGoogleMapViewShadowNode>;
21
22
  using RNMapsGooglePolygonComponentDescriptor = ConcreteComponentDescriptor<RNMapsGooglePolygonShadowNode>;
22
23
  using RNMapsMapViewComponentDescriptor = ConcreteComponentDescriptor<RNMapsMapViewShadowNode>;
@@ -35,6 +35,28 @@ $payload.setProperty(runtime, "id", $event.id);
35
35
  }
36
36
 
37
37
 
38
+ void RNMapsCircleEventEmitter::onPress(OnPress $event) const {
39
+ dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
40
+ auto $payload = jsi::Object(runtime);
41
+ $payload.setProperty(runtime, "action", $event.action);
42
+ $payload.setProperty(runtime, "id", $event.id);
43
+ {
44
+ auto coordinate = jsi::Object(runtime);
45
+ coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
46
+ coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
47
+ $payload.setProperty(runtime, "coordinate", coordinate);
48
+ }
49
+ {
50
+ auto position = jsi::Object(runtime);
51
+ position.setProperty(runtime, "x", $event.position.x);
52
+ position.setProperty(runtime, "y", $event.position.y);
53
+ $payload.setProperty(runtime, "position", position);
54
+ }
55
+ return $payload;
56
+ });
57
+ }
58
+
59
+
38
60
  void RNMapsGoogleMapViewEventEmitter::onIndoorBuildingFocused(OnIndoorBuildingFocused $event) const {
39
61
  dispatchEvent("indoorBuildingFocused", [$event=std::move($event)](jsi::Runtime &runtime) {
40
62
  auto $payload = jsi::Object(runtime);
@@ -35,6 +35,28 @@ class RNMapsCalloutEventEmitter : public ViewEventEmitter {
35
35
  };
36
36
  void onPress(OnPress value) const;
37
37
  };
38
+ class RNMapsCircleEventEmitter : public ViewEventEmitter {
39
+ public:
40
+ using ViewEventEmitter::ViewEventEmitter;
41
+
42
+ struct OnPressCoordinate {
43
+ double latitude;
44
+ double longitude;
45
+ };
46
+
47
+ struct OnPressPosition {
48
+ double x;
49
+ double y;
50
+ };
51
+
52
+ struct OnPress {
53
+ std::string action;
54
+ std::string id;
55
+ OnPressCoordinate coordinate;
56
+ OnPressPosition position;
57
+ };
58
+ void onPress(OnPress value) const;
59
+ };
38
60
  class RNMapsGoogleMapViewEventEmitter : public ViewEventEmitter {
39
61
  public:
40
62
  using ViewEventEmitter::ViewEventEmitter;
@@ -23,6 +23,18 @@ RNMapsCalloutProps::RNMapsCalloutProps(
23
23
  alphaHitTest(convertRawProp(context, rawProps, "alphaHitTest", sourceProps.alphaHitTest, {false})),
24
24
  tooltip(convertRawProp(context, rawProps, "tooltip", sourceProps.tooltip, {false}))
25
25
  {}
26
+ RNMapsCircleProps::RNMapsCircleProps(
27
+ const PropsParserContext &context,
28
+ const RNMapsCircleProps &sourceProps,
29
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
30
+
31
+ center(convertRawProp(context, rawProps, "center", sourceProps.center, {})),
32
+ fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, {})),
33
+ radius(convertRawProp(context, rawProps, "radius", sourceProps.radius, {0.0})),
34
+ strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
35
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
36
+ tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
37
+ {}
26
38
  RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
27
39
  const PropsParserContext &context,
28
40
  const RNMapsGoogleMapViewProps &sourceProps,
@@ -29,6 +29,42 @@ class RNMapsCalloutProps final : public ViewProps {
29
29
  bool tooltip{false};
30
30
  };
31
31
 
32
+ struct RNMapsCircleCenterStruct {
33
+ double latitude{0.0};
34
+ double longitude{0.0};
35
+ };
36
+
37
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsCircleCenterStruct &result) {
38
+ auto map = (std::unordered_map<std::string, RawValue>)value;
39
+
40
+ auto tmp_latitude = map.find("latitude");
41
+ if (tmp_latitude != map.end()) {
42
+ fromRawValue(context, tmp_latitude->second, result.latitude);
43
+ }
44
+ auto tmp_longitude = map.find("longitude");
45
+ if (tmp_longitude != map.end()) {
46
+ fromRawValue(context, tmp_longitude->second, result.longitude);
47
+ }
48
+ }
49
+
50
+ static inline std::string toString(const RNMapsCircleCenterStruct &value) {
51
+ return "[Object RNMapsCircleCenterStruct]";
52
+ }
53
+ class RNMapsCircleProps final : public ViewProps {
54
+ public:
55
+ RNMapsCircleProps() = default;
56
+ RNMapsCircleProps(const PropsParserContext& context, const RNMapsCircleProps &sourceProps, const RawProps &rawProps);
57
+
58
+ #pragma mark - Props
59
+
60
+ RNMapsCircleCenterStruct center{};
61
+ SharedColor fillColor{};
62
+ double radius{0.0};
63
+ SharedColor strokeColor{};
64
+ Float strokeWidth{0.0};
65
+ bool tappable{false};
66
+ };
67
+
32
68
  enum class RNMapsGoogleMapViewMapType { Hybrid, MutedStandard, None, Satellite, Standard, Terrain, SatelliteFlyover, HybridFlyover };
33
69
 
34
70
  static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsGoogleMapViewMapType &result) {
@@ -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;
@@ -13,6 +13,7 @@
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";
@@ -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
  /*
@@ -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;
@@ -11,6 +11,7 @@ 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"));
14
15
  exports.SUPPORTED = 'SUPPORTED';
15
16
  exports.USES_DEFAULT_IMPLEMENTATION = 'USES_DEFAULT_IMPLEMENTATION';
16
17
  exports.NOT_SUPPORTED = 'NOT_SUPPORTED';
@@ -63,6 +64,10 @@ function decorateMapComponent(Component, componentName, providers) {
63
64
  // @ts-ignore
64
65
  return NativeComponentPolyline_1.default;
65
66
  }
67
+ else if (componentName === 'Circle') {
68
+ // @ts-ignore
69
+ return NativeComponentCircle_1.default;
70
+ }
66
71
  }
67
72
  const key = provider || 'default';
68
73
  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', {});
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.82",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",