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
@@ -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.ReadableArray;
8
+ import com.facebook.react.bridge.ReadableMap;
9
+ import com.facebook.react.module.annotations.ReactModule;
10
+ import com.facebook.react.uimanager.ThemedReactContext;
11
+ import com.facebook.react.uimanager.ViewGroupManager;
12
+ import com.facebook.react.uimanager.ViewManagerDelegate;
13
+ import com.facebook.react.viewmanagers.RNMapsOverlayManagerDelegate;
14
+ import com.facebook.react.viewmanagers.RNMapsOverlayManagerInterface;
15
+ import com.rnmaps.maps.MapOverlay;
16
+
17
+ import java.util.HashMap;
18
+ import java.util.Map;
19
+
20
+ @ReactModule(name = OverlayManager.REACT_CLASS)
21
+ public class OverlayManager extends ViewGroupManager<MapOverlay> implements RNMapsOverlayManagerInterface<MapOverlay> {
22
+ public OverlayManager(ReactApplicationContext context) {
23
+ super(context);
24
+ }
25
+
26
+ private final RNMapsOverlayManagerDelegate<MapOverlay, OverlayManager> delegate =
27
+ new RNMapsOverlayManagerDelegate<>(this);
28
+
29
+ @Override
30
+ public ViewManagerDelegate<MapOverlay> getDelegate() {
31
+ return delegate;
32
+ }
33
+
34
+ @Override
35
+ public String getName() {
36
+ return REACT_CLASS;
37
+ }
38
+
39
+ @Override
40
+ public MapOverlay createViewInstance(ThemedReactContext context) {
41
+ return new MapOverlay(context);
42
+ }
43
+
44
+
45
+ public static final String REACT_CLASS = "RNMapsOverlay";
46
+
47
+ @Nullable
48
+ @Override
49
+ public Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
50
+ return MapOverlay.getExportedCustomBubblingEventTypeConstants();
51
+ }
52
+
53
+ @Nullable
54
+ @Override
55
+ public Map<String, Object> getExportedCustomDirectEventTypeConstants() {
56
+ return new HashMap<>();
57
+ }
58
+
59
+
60
+
61
+ @Override
62
+ public void setZIndex(MapOverlay view, float value) {
63
+ view.setZIndex(value);
64
+ }
65
+
66
+
67
+ @Override
68
+ public void setBearing(MapOverlay view, float value) {
69
+ view.setBearing(value);
70
+ }
71
+
72
+ @Override
73
+ public void setBounds(MapOverlay view, @Nullable ReadableArray value) {
74
+ view.setBounds(value);
75
+ }
76
+
77
+ @Override
78
+ public void setImage(MapOverlay view, @Nullable ReadableMap value) {
79
+ if (value != null) {
80
+ view.setImage(value.getString("uri"));
81
+ }
82
+ }
83
+
84
+
85
+ @Override
86
+ public void setOpacity(MapOverlay view, float value) {
87
+ view.setTransparency(value);
88
+ }
89
+
90
+ @Override
91
+ public void setTappable(MapOverlay view, boolean value) {
92
+ view.setTappable(value);
93
+ }
94
+ }
@@ -9,10 +9,12 @@ 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;
15
16
  import com.facebook.fbreact.specs.NativeAirMapsModuleSpec;
17
+ import com.rnmaps.fabric.OverlayManager;
16
18
  import com.rnmaps.fabric.PolygonManager;
17
19
  import com.rnmaps.fabric.PolylineManager;
18
20
 
@@ -24,12 +26,18 @@ public class MapAirModulePackage extends TurboReactPackage {
24
26
 
25
27
  @Override
26
28
  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));
29
+ return List.of(new MapViewManager(reactContext), new MarkerManager(reactContext), new CalloutManager(reactContext), new PolygonManager(reactContext), new PolylineManager(reactContext), new CircleManager(reactContext), new OverlayManager(reactContext));
28
30
  }
29
31
 
30
32
 
31
33
  @Override
32
34
  public NativeModule getModule(String name, ReactApplicationContext reactContext) {
35
+ if (OverlayManager.REACT_CLASS.equals(name)) {
36
+ return new OverlayManager(reactContext);
37
+ }
38
+ if (CircleManager.REACT_CLASS.equals(name)) {
39
+ return new CircleManager(reactContext);
40
+ }
33
41
  if (PolylineManager.REACT_CLASS.equals(name)) {
34
42
  return new PolylineManager(reactContext);
35
43
  }
@@ -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
  }
@@ -2,8 +2,33 @@ package com.rnmaps.maps;
2
2
 
3
3
  import android.content.Context;
4
4
  import android.graphics.Bitmap;
5
+ import android.graphics.BitmapFactory;
6
+ import android.graphics.Canvas;
7
+ import android.graphics.drawable.Animatable;
8
+ import android.graphics.drawable.Drawable;
9
+ import android.net.Uri;
5
10
 
11
+ import androidx.annotation.Nullable;
12
+
13
+ import com.facebook.common.references.CloseableReference;
14
+ import com.facebook.datasource.DataSource;
15
+ import com.facebook.drawee.backends.pipeline.Fresco;
16
+ import com.facebook.drawee.controller.BaseControllerListener;
17
+ import com.facebook.drawee.controller.ControllerListener;
18
+ import com.facebook.drawee.drawable.ScalingUtils;
19
+ import com.facebook.drawee.generic.GenericDraweeHierarchy;
20
+ import com.facebook.drawee.generic.GenericDraweeHierarchyBuilder;
21
+ import com.facebook.drawee.interfaces.DraweeController;
22
+ import com.facebook.drawee.view.DraweeHolder;
23
+ import com.facebook.imagepipeline.core.ImagePipeline;
24
+ import com.facebook.imagepipeline.image.CloseableImage;
25
+ import com.facebook.imagepipeline.image.CloseableStaticBitmap;
26
+ import com.facebook.imagepipeline.image.ImageInfo;
27
+ import com.facebook.imagepipeline.request.ImageRequest;
28
+ import com.facebook.imagepipeline.request.ImageRequestBuilder;
6
29
  import com.facebook.react.bridge.ReadableArray;
30
+ import com.facebook.react.common.MapBuilder;
31
+ import com.google.android.gms.common.images.ImageManager;
7
32
  import com.google.android.gms.maps.model.BitmapDescriptor;
8
33
  import com.google.android.gms.maps.model.BitmapDescriptorFactory;
9
34
  import com.google.android.gms.maps.model.GroundOverlay;
@@ -11,30 +36,127 @@ import com.google.android.gms.maps.model.GroundOverlayOptions;
11
36
  import com.google.android.gms.maps.model.LatLng;
12
37
  import com.google.android.gms.maps.model.LatLngBounds;
13
38
  import com.google.maps.android.collections.GroundOverlayManager;
39
+ import com.rnmaps.fabric.event.OnPressEvent;
40
+
41
+ import java.util.Map;
14
42
 
15
43
  public class MapOverlay extends MapFeature implements ImageReadable {
16
44
 
45
+
46
+ private String imageUri;
47
+ private boolean loadingImage;
48
+
17
49
  private GroundOverlayOptions groundOverlayOptions;
18
50
  private GroundOverlay groundOverlay;
19
51
  private LatLngBounds bounds;
20
52
  private float bearing;
21
53
  private BitmapDescriptor iconBitmapDescriptor;
54
+ private Bitmap iconBitmap;
22
55
  private boolean tappable;
23
56
  private float zIndex;
24
57
  private float transparency;
25
58
 
59
+ private DataSource<CloseableReference<CloseableImage>> dataSource;
60
+
26
61
  private final ImageReader mImageReader;
27
62
  private GroundOverlayManager.Collection groundOverlayCollection;
28
63
 
64
+ private final DraweeHolder<?> logoHolder;
65
+ private ImageManager.OnImageLoadedListener imageLoadedListener;
66
+
67
+ public boolean isLoadingImage() {
68
+ return loadingImage;
69
+ }
70
+
71
+ public ImageManager.OnImageLoadedListener getImageLoadedListener() {
72
+ return imageLoadedListener;
73
+ }
74
+
75
+ public void setImageLoadedListener(ImageManager.OnImageLoadedListener imageLoadedListener) {
76
+ this.imageLoadedListener = imageLoadedListener;
77
+ }
78
+
79
+
29
80
  public MapOverlay(Context context) {
30
81
  super(context);
31
82
  this.mImageReader = new ImageReader(context, getResources(), this);
83
+ logoHolder = DraweeHolder.create(createDraweeHierarchy(), context);
84
+ logoHolder.onAttach();
85
+ }
86
+
87
+ private GenericDraweeHierarchy createDraweeHierarchy() {
88
+ return new GenericDraweeHierarchyBuilder(getResources())
89
+ .setActualImageScaleType(ScalingUtils.ScaleType.FIT_CENTER)
90
+ .setFadeDuration(0)
91
+ .build();
92
+ }
93
+
94
+ private final ControllerListener<ImageInfo> mLogoControllerListener =
95
+ new BaseControllerListener<ImageInfo>() {
96
+ @Override
97
+ public void onSubmit(String id, Object callerContext){
98
+ loadingImage = true;
99
+ }
100
+ @Override
101
+ public void onFinalImageSet(
102
+ String id,
103
+ @Nullable final ImageInfo imageInfo,
104
+ @Nullable Animatable animatable) {
105
+ CloseableReference<CloseableImage> imageReference = null;
106
+ try {
107
+ imageReference = dataSource.getResult();
108
+ if (imageReference != null) {
109
+ CloseableImage image = imageReference.get();
110
+ if (image instanceof CloseableStaticBitmap) {
111
+ CloseableStaticBitmap closeableStaticBitmap = (CloseableStaticBitmap) image;
112
+ Bitmap bitmap = closeableStaticBitmap.getUnderlyingBitmap();
113
+ if (bitmap != null) {
114
+ bitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
115
+ iconBitmap = bitmap;
116
+ iconBitmapDescriptor = BitmapDescriptorFactory.fromBitmap(bitmap);
117
+ }
118
+ }
119
+ }
120
+ } finally {
121
+ dataSource.close();
122
+ if (imageReference != null) {
123
+ CloseableReference.closeSafely(imageReference);
124
+ }
125
+ }
126
+
127
+ loadingImage = false;
128
+ if (imageLoadedListener != null){
129
+ imageLoadedListener.onImageLoaded(null, null, false);
130
+ // fire and forget
131
+ imageLoadedListener = null;
132
+ }
133
+ update();
134
+ }
135
+ };
136
+
137
+ // seems like apple users north west, south east
138
+ // google uses north east, south west
139
+ private static LatLngBounds fixBoundsIfNecessary(ReadableArray bounds){
140
+ double lat1 = bounds.getArray(0).getDouble(0);
141
+ double lon1 = bounds.getArray(0).getDouble(1);
142
+ double lat2 = bounds.getArray(1).getDouble(0);
143
+ double lon2 = bounds.getArray(1).getDouble(1);
144
+
145
+ // Ensure lat1/lon1 is the SW corner and lat2/lon2 is the NE corner
146
+ double southLat = Math.min(lat1, lat2);
147
+ double northLat = Math.max(lat1, lat2);
148
+ double westLon = Math.min(lon1, lon2);
149
+ double eastLon = Math.max(lon1, lon2);
150
+
151
+ // Create corrected LatLngs
152
+ LatLng sw = new LatLng(southLat, westLon);
153
+ LatLng ne = new LatLng(northLat, eastLon);
154
+ return new LatLngBounds(sw, ne);
32
155
  }
33
156
 
34
157
  public void setBounds(ReadableArray bounds) {
35
- LatLng sw = new LatLng(bounds.getArray(0).getDouble(0), bounds.getArray(0).getDouble(1));
36
- LatLng ne = new LatLng(bounds.getArray(1).getDouble(0), bounds.getArray(1).getDouble(1));
37
- this.bounds = new LatLngBounds(sw, ne);
158
+
159
+ this.bounds = fixBoundsIfNecessary(bounds);
38
160
  if (this.groundOverlay != null) {
39
161
  this.groundOverlay.setPositionFromBounds(this.bounds);
40
162
  }
@@ -63,6 +185,51 @@ public class MapOverlay extends MapFeature implements ImageReadable {
63
185
 
64
186
  public void setImage(String uri) {
65
187
  this.mImageReader.setImage(uri);
188
+ boolean shouldLoadImage = true;
189
+
190
+ this.imageUri = uri;
191
+ if (!shouldLoadImage) {return;}
192
+
193
+ if (uri == null) {
194
+ iconBitmapDescriptor = null;
195
+ } else if (uri.startsWith("http://") || uri.startsWith("https://") ||
196
+ uri.startsWith("file://") || uri.startsWith("asset://") || uri.startsWith("data:")) {
197
+ ImageRequest imageRequest = ImageRequestBuilder
198
+ .newBuilderWithSource(Uri.parse(uri))
199
+ .build();
200
+
201
+ ImagePipeline imagePipeline = Fresco.getImagePipeline();
202
+ dataSource = imagePipeline.fetchDecodedImage(imageRequest, this);
203
+ DraweeController controller = Fresco.newDraweeControllerBuilder()
204
+ .setImageRequest(imageRequest)
205
+ .setControllerListener(mLogoControllerListener)
206
+ .setOldController(logoHolder.getController())
207
+ .build();
208
+ logoHolder.setController(controller);
209
+ } else {
210
+ iconBitmapDescriptor = getBitmapDescriptorByName(uri);
211
+ int drawableId = getDrawableResourceByName(uri);
212
+ iconBitmap = BitmapFactory.decodeResource(getResources(), drawableId);
213
+ if (iconBitmap == null) { // VectorDrawable or similar
214
+ Drawable drawable = getResources().getDrawable(drawableId);
215
+ iconBitmap = Bitmap.createBitmap(drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
216
+ drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight());
217
+ Canvas canvas = new Canvas(iconBitmap);
218
+ drawable.draw(canvas);
219
+ }
220
+
221
+ }
222
+ }
223
+
224
+ private BitmapDescriptor getBitmapDescriptorByName(String name) {
225
+ return BitmapDescriptorFactory.fromResource(getDrawableResourceByName(name));
226
+ }
227
+
228
+ private int getDrawableResourceByName(String name) {
229
+ return getResources().getIdentifier(
230
+ name,
231
+ "drawable",
232
+ getContext().getPackageName());
66
233
  }
67
234
 
68
235
  public void setTappable(boolean tapabble) {
@@ -72,6 +239,11 @@ public class MapOverlay extends MapFeature implements ImageReadable {
72
239
  }
73
240
  }
74
241
 
242
+ public static Map<String, Object> getExportedCustomBubblingEventTypeConstants() {
243
+ MapBuilder.Builder<String, Object> builder = MapBuilder.builder();
244
+ builder.put(OnPressEvent.EVENT_NAME, MapBuilder.of("registrationName", OnPressEvent.EVENT_NAME));
245
+ return builder.build();
246
+ }
75
247
 
76
248
  public GroundOverlayOptions getGroundOverlayOptions() {
77
249
  if (this.groundOverlayOptions == null) {
@@ -17,10 +17,12 @@ 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>());
23
24
  registry->add(concreteComponentDescriptorProvider<RNMapsMarkerComponentDescriptor>());
25
+ registry->add(concreteComponentDescriptorProvider<RNMapsOverlayComponentDescriptor>());
24
26
  registry->add(concreteComponentDescriptorProvider<RNMapsPolylineComponentDescriptor>());
25
27
  }
26
28
 
@@ -17,10 +17,12 @@
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>;
23
24
  using RNMapsMarkerComponentDescriptor = ConcreteComponentDescriptor<RNMapsMarkerShadowNode>;
25
+ using RNMapsOverlayComponentDescriptor = ConcreteComponentDescriptor<RNMapsOverlayShadowNode>;
24
26
  using RNMapsPolylineComponentDescriptor = ConcreteComponentDescriptor<RNMapsPolylineShadowNode>;
25
27
 
26
28
  void RNMapsSpecs_registerComponentDescriptorsFromCodegen(
@@ -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);
@@ -916,6 +938,28 @@ $payload.setProperty(runtime, "id", $event.id);
916
938
  }
917
939
 
918
940
 
941
+ void RNMapsOverlayEventEmitter::onPress(OnPress $event) const {
942
+ dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
943
+ auto $payload = jsi::Object(runtime);
944
+ $payload.setProperty(runtime, "action", $event.action);
945
+ $payload.setProperty(runtime, "id", $event.id);
946
+ {
947
+ auto coordinate = jsi::Object(runtime);
948
+ coordinate.setProperty(runtime, "latitude", $event.coordinate.latitude);
949
+ coordinate.setProperty(runtime, "longitude", $event.coordinate.longitude);
950
+ $payload.setProperty(runtime, "coordinate", coordinate);
951
+ }
952
+ {
953
+ auto position = jsi::Object(runtime);
954
+ position.setProperty(runtime, "x", $event.position.x);
955
+ position.setProperty(runtime, "y", $event.position.y);
956
+ $payload.setProperty(runtime, "position", position);
957
+ }
958
+ return $payload;
959
+ });
960
+ }
961
+
962
+
919
963
  void RNMapsPolylineEventEmitter::onPress(OnPress $event) const {
920
964
  dispatchEvent("press", [$event=std::move($event)](jsi::Runtime &runtime) {
921
965
  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;
@@ -784,6 +806,28 @@ class RNMapsMarkerEventEmitter : public ViewEventEmitter {
784
806
 
785
807
  void onSelect(OnSelect value) const;
786
808
  };
809
+ class RNMapsOverlayEventEmitter : public ViewEventEmitter {
810
+ public:
811
+ using ViewEventEmitter::ViewEventEmitter;
812
+
813
+ struct OnPressCoordinate {
814
+ double latitude;
815
+ double longitude;
816
+ };
817
+
818
+ struct OnPressPosition {
819
+ double x;
820
+ double y;
821
+ };
822
+
823
+ struct OnPress {
824
+ std::string action;
825
+ std::string id;
826
+ OnPressCoordinate coordinate;
827
+ OnPressPosition position;
828
+ };
829
+ void onPress(OnPress value) const;
830
+ };
787
831
  class RNMapsPolylineEventEmitter : public ViewEventEmitter {
788
832
  public:
789
833
  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,
@@ -151,6 +163,17 @@ RNMapsMarkerProps::RNMapsMarkerProps(
151
163
  subtitleVisibility(convertRawProp(context, rawProps, "subtitleVisibility", sourceProps.subtitleVisibility, {RNMapsMarkerSubtitleVisibility::Adaptive})),
152
164
  useLegacyPinView(convertRawProp(context, rawProps, "useLegacyPinView", sourceProps.useLegacyPinView, {false}))
153
165
  {}
166
+ RNMapsOverlayProps::RNMapsOverlayProps(
167
+ const PropsParserContext &context,
168
+ const RNMapsOverlayProps &sourceProps,
169
+ const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
170
+
171
+ bearing(convertRawProp(context, rawProps, "bearing", sourceProps.bearing, {0.0})),
172
+ bounds(convertRawProp(context, rawProps, "bounds", sourceProps.bounds, {})),
173
+ image(convertRawProp(context, rawProps, "image", sourceProps.image, {})),
174
+ opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, {1.0})),
175
+ tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
176
+ {}
154
177
  RNMapsPolylineProps::RNMapsPolylineProps(
155
178
  const PropsParserContext &context,
156
179
  const RNMapsPolylineProps &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) {
@@ -1056,6 +1092,51 @@ class RNMapsMarkerProps final : public ViewProps {
1056
1092
  bool useLegacyPinView{false};
1057
1093
  };
1058
1094
 
1095
+ struct RNMapsOverlayBoundsStruct {
1096
+ double latitude{0.0};
1097
+ double longitude{0.0};
1098
+ };
1099
+
1100
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsOverlayBoundsStruct &result) {
1101
+ auto map = (std::unordered_map<std::string, RawValue>)value;
1102
+
1103
+ auto tmp_latitude = map.find("latitude");
1104
+ if (tmp_latitude != map.end()) {
1105
+ fromRawValue(context, tmp_latitude->second, result.latitude);
1106
+ }
1107
+ auto tmp_longitude = map.find("longitude");
1108
+ if (tmp_longitude != map.end()) {
1109
+ fromRawValue(context, tmp_longitude->second, result.longitude);
1110
+ }
1111
+ }
1112
+
1113
+ static inline std::string toString(const RNMapsOverlayBoundsStruct &value) {
1114
+ return "[Object RNMapsOverlayBoundsStruct]";
1115
+ }
1116
+
1117
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, std::vector<RNMapsOverlayBoundsStruct> &result) {
1118
+ auto items = (std::vector<RawValue>)value;
1119
+ for (const auto &item : items) {
1120
+ RNMapsOverlayBoundsStruct newItem;
1121
+ fromRawValue(context, item, newItem);
1122
+ result.emplace_back(newItem);
1123
+ }
1124
+ }
1125
+
1126
+ class RNMapsOverlayProps final : public ViewProps {
1127
+ public:
1128
+ RNMapsOverlayProps() = default;
1129
+ RNMapsOverlayProps(const PropsParserContext& context, const RNMapsOverlayProps &sourceProps, const RawProps &rawProps);
1130
+
1131
+ #pragma mark - Props
1132
+
1133
+ Float bearing{0.0};
1134
+ std::vector<RNMapsOverlayBoundsStruct> bounds{};
1135
+ ImageSource image{};
1136
+ Float opacity{1.0};
1137
+ bool tappable{false};
1138
+ };
1139
+
1059
1140
  enum class RNMapsPolylineLineCap { Butt, Round, Square };
1060
1141
 
1061
1142
  static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsPolylineLineCap &result) {