react-native-maps 1.24.9 → 1.24.11

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.
@@ -37,7 +37,7 @@ public class RNMapsCircleManagerDelegate<T extends View, U extends BaseViewManag
37
37
  mViewManager.setStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
38
38
  break;
39
39
  case "strokeWidth":
40
- mViewManager.setStrokeWidth(view, value == null ? 0f : ((Double) value).floatValue());
40
+ mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
41
41
  break;
42
42
  case "tappable":
43
43
  mViewManager.setTappable(view, value == null ? false : (boolean) value);
@@ -33,6 +33,9 @@ public class RNMapsGooglePolygonManagerDelegate<T extends View, U extends BaseVi
33
33
  case "strokeColor":
34
34
  mViewManager.setStrokeColor(view, ColorPropConverter.getColor(value, view.getContext()));
35
35
  break;
36
+ case "strokeWidth":
37
+ mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
38
+ break;
36
39
  case "geodesic":
37
40
  mViewManager.setGeodesic(view, value == null ? false : (boolean) value);
38
41
  break;
@@ -17,6 +17,7 @@ public interface RNMapsGooglePolygonManagerInterface<T extends View> {
17
17
  void setCoordinates(T view, @Nullable ReadableArray value);
18
18
  void setFillColor(T view, @Nullable Integer value);
19
19
  void setStrokeColor(T view, @Nullable Integer value);
20
+ void setStrokeWidth(T view, float value);
20
21
  void setGeodesic(T view, boolean value);
21
22
  void setHoles(T view, @Nullable ReadableArray value);
22
23
  void setTappable(T view, boolean value);
@@ -40,6 +40,9 @@ public class RNMapsMarkerManagerDelegate<T extends View, U extends BaseViewManag
40
40
  case "displayPriority":
41
41
  mViewManager.setDisplayPriority(view, (String) value);
42
42
  break;
43
+ case "centerOffset":
44
+ mViewManager.setCenterOffset(view, (ReadableMap) value);
45
+ break;
43
46
  case "coordinate":
44
47
  mViewManager.setCoordinate(view, (ReadableMap) value);
45
48
  break;
@@ -19,6 +19,7 @@ public interface RNMapsMarkerManagerInterface<T extends View> {
19
19
  void setImage(T view, @Nullable ReadableMap value);
20
20
  void setCalloutOffset(T view, @Nullable ReadableMap value);
21
21
  void setDisplayPriority(T view, @Nullable String value);
22
+ void setCenterOffset(T view, @Nullable ReadableMap value);
22
23
  void setCoordinate(T view, @Nullable ReadableMap value);
23
24
  void setDescription(T view, @Nullable String value);
24
25
  void setDraggable(T view, boolean value);
@@ -46,7 +46,7 @@ public class RNMapsPolylineManagerDelegate<T extends View, U extends BaseViewMan
46
46
  mViewManager.setStrokeColors(view, (ReadableArray) value);
47
47
  break;
48
48
  case "strokeWidth":
49
- mViewManager.setStrokeWidth(view, value == null ? 0f : ((Double) value).floatValue());
49
+ mViewManager.setStrokeWidth(view, value == null ? 1f : ((Double) value).floatValue());
50
50
  break;
51
51
  case "tappable":
52
52
  mViewManager.setTappable(view, value == null ? false : (boolean) value);
@@ -158,6 +158,10 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
158
158
 
159
159
  }
160
160
 
161
+ @Override
162
+ public void setCenterOffset(MapMarker view, @Nullable ReadableMap value) {
163
+ }
164
+
161
165
  @Override
162
166
  public void setCoordinate(MapMarker view, @Nullable ReadableMap value) {
163
167
  view.setCoordinate(value);
@@ -2,7 +2,7 @@ package com.rnmaps.fabric;
2
2
 
3
3
 
4
4
  import androidx.annotation.Nullable;
5
-
5
+ import android.util.DisplayMetrics;
6
6
  import com.facebook.react.bridge.ReactApplicationContext;
7
7
  import com.facebook.react.bridge.ReadableArray;
8
8
  import com.facebook.react.module.annotations.ReactModule;
@@ -72,6 +72,13 @@ public class PolygonManager extends ViewGroupManager<MapPolygon> implements RNMa
72
72
  view.setStrokeColor(value);
73
73
  }
74
74
 
75
+ @Override
76
+ public void setStrokeWidth(MapPolygon view, float value) {
77
+ DisplayMetrics metrics = view.getContext().getResources().getDisplayMetrics();
78
+ float widthInScreenPx = metrics.density * value; // done for parity with iOS
79
+ view.setStrokeWidth(widthInScreenPx);
80
+ }
81
+
75
82
  @Override
76
83
  public void setGeodesic(MapPolygon view, boolean value) {
77
84
  view.setGeodesic(value);
@@ -86,4 +93,4 @@ public class PolygonManager extends ViewGroupManager<MapPolygon> implements RNMa
86
93
  public void setTappable(MapPolygon view, boolean value) {
87
94
  view.setTappable(value);
88
95
  }
89
- }
96
+ }
@@ -128,8 +128,7 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
128
128
  private String customMapStyleString;
129
129
  private boolean initialRegionSet = false;
130
130
  private boolean initialCameraSet = false;
131
- private LatLngBounds cameraLastIdleBounds;
132
- private int cameraMoveReason = 0;
131
+ private int cameraMoveReason = -1;
133
132
  private MapMarker selectedMarker;
134
133
 
135
134
  private LifecycleOwner currentLifecycleOwner;
@@ -601,24 +600,18 @@ public class MapView extends com.google.android.gms.maps.MapView implements Goog
601
600
  });
602
601
 
603
602
  map.setOnCameraMoveListener(() -> {
604
- LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
605
- cameraLastIdleBounds = null;
606
603
  boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
604
+ LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
607
605
  WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
608
606
  dispatchEvent(payload, OnRegionChangeEvent::new);
609
607
  });
610
608
 
611
609
  map.setOnCameraIdleListener(() -> {
610
+ boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
611
+ cameraMoveReason = -1;
612
612
  LatLngBounds bounds = map.getProjection().getVisibleRegion().latLngBounds;
613
- if ((cameraMoveReason != 0) &&
614
- ((cameraLastIdleBounds == null) ||
615
- LatLngBoundsUtils.BoundsAreDifferent(bounds, cameraLastIdleBounds))) {
616
-
617
- cameraLastIdleBounds = bounds;
618
- boolean isGesture = GoogleMap.OnCameraMoveStartedListener.REASON_GESTURE == cameraMoveReason;
619
- WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
620
- dispatchEvent(payload, OnRegionChangeCompleteEvent::new);
621
- }
613
+ WritableMap payload = OnRegionChangeEvent.payLoadFor(bounds, isGesture);
614
+ dispatchEvent(payload, OnRegionChangeCompleteEvent::new);
622
615
  });
623
616
 
624
617
  map.setOnMapLoadedCallback(() -> {
@@ -32,7 +32,7 @@ RNMapsCircleProps::RNMapsCircleProps(
32
32
  fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, {})),
33
33
  radius(convertRawProp(context, rawProps, "radius", sourceProps.radius, {0.0})),
34
34
  strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
35
- strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
35
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {1.0})),
36
36
  tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
37
37
  {}
38
38
  RNMapsGoogleMapViewProps::RNMapsGoogleMapViewProps(
@@ -83,6 +83,7 @@ RNMapsGooglePolygonProps::RNMapsGooglePolygonProps(
83
83
  coordinates(convertRawProp(context, rawProps, "coordinates", sourceProps.coordinates, {})),
84
84
  fillColor(convertRawProp(context, rawProps, "fillColor", sourceProps.fillColor, {})),
85
85
  strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
86
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {1.0})),
86
87
  geodesic(convertRawProp(context, rawProps, "geodesic", sourceProps.geodesic, {false})),
87
88
  holes(convertRawProp(context, rawProps, "holes", sourceProps.holes, {})),
88
89
  tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
@@ -153,6 +154,7 @@ RNMapsMarkerProps::RNMapsMarkerProps(
153
154
  image(convertRawProp(context, rawProps, "image", sourceProps.image, {})),
154
155
  calloutOffset(convertRawProp(context, rawProps, "calloutOffset", sourceProps.calloutOffset, {})),
155
156
  displayPriority(convertRawProp(context, rawProps, "displayPriority", sourceProps.displayPriority, {RNMapsMarkerDisplayPriority::Required})),
157
+ centerOffset(convertRawProp(context, rawProps, "centerOffset", sourceProps.centerOffset, {})),
156
158
  coordinate(convertRawProp(context, rawProps, "coordinate", sourceProps.coordinate, {})),
157
159
  description(convertRawProp(context, rawProps, "description", sourceProps.description, {})),
158
160
  draggable(convertRawProp(context, rawProps, "draggable", sourceProps.draggable, {false})),
@@ -189,7 +191,7 @@ RNMapsPolylineProps::RNMapsPolylineProps(
189
191
  lineJoin(convertRawProp(context, rawProps, "lineJoin", sourceProps.lineJoin, {RNMapsPolylineLineJoin::Miter})),
190
192
  strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
191
193
  strokeColors(convertRawProp(context, rawProps, "strokeColors", sourceProps.strokeColors, {})),
192
- strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
194
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {1.0})),
193
195
  tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
194
196
  {}
195
197
  RNMapsUrlTileProps::RNMapsUrlTileProps(
@@ -61,7 +61,7 @@ class RNMapsCircleProps final : public ViewProps {
61
61
  SharedColor fillColor{};
62
62
  double radius{0.0};
63
63
  SharedColor strokeColor{};
64
- Float strokeWidth{0.0};
64
+ Float strokeWidth{1.0};
65
65
  bool tappable{false};
66
66
  };
67
67
 
@@ -478,6 +478,7 @@ class RNMapsGooglePolygonProps final : public ViewProps {
478
478
  std::vector<RNMapsGooglePolygonCoordinatesStruct> coordinates{};
479
479
  SharedColor fillColor{};
480
480
  SharedColor strokeColor{};
481
+ Float strokeWidth{1.0};
481
482
  bool geodesic{false};
482
483
  std::vector<std::vector<RNMapsGooglePolygonHolesStruct>> holes{};
483
484
  bool tappable{false};
@@ -1048,6 +1049,28 @@ static inline std::string toString(const RNMapsMarkerCalloutOffsetStruct &value)
1048
1049
  return "[Object RNMapsMarkerCalloutOffsetStruct]";
1049
1050
  }
1050
1051
 
1052
+ struct RNMapsMarkerCenterOffsetStruct {
1053
+ double x{0.0};
1054
+ double y{0.0};
1055
+ };
1056
+
1057
+ static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNMapsMarkerCenterOffsetStruct &result) {
1058
+ auto map = (std::unordered_map<std::string, RawValue>)value;
1059
+
1060
+ auto tmp_x = map.find("x");
1061
+ if (tmp_x != map.end()) {
1062
+ fromRawValue(context, tmp_x->second, result.x);
1063
+ }
1064
+ auto tmp_y = map.find("y");
1065
+ if (tmp_y != map.end()) {
1066
+ fromRawValue(context, tmp_y->second, result.y);
1067
+ }
1068
+ }
1069
+
1070
+ static inline std::string toString(const RNMapsMarkerCenterOffsetStruct &value) {
1071
+ return "[Object RNMapsMarkerCenterOffsetStruct]";
1072
+ }
1073
+
1051
1074
  struct RNMapsMarkerCoordinateStruct {
1052
1075
  double latitude{0.0};
1053
1076
  double longitude{0.0};
@@ -1081,6 +1104,7 @@ class RNMapsMarkerProps final : public ViewProps {
1081
1104
  ImageSource image{};
1082
1105
  RNMapsMarkerCalloutOffsetStruct calloutOffset{};
1083
1106
  RNMapsMarkerDisplayPriority displayPriority{RNMapsMarkerDisplayPriority::Required};
1107
+ RNMapsMarkerCenterOffsetStruct centerOffset{};
1084
1108
  RNMapsMarkerCoordinateStruct coordinate{};
1085
1109
  std::string description{};
1086
1110
  bool draggable{false};
@@ -1253,7 +1277,7 @@ class RNMapsPolylineProps final : public ViewProps {
1253
1277
  RNMapsPolylineLineJoin lineJoin{RNMapsPolylineLineJoin::Miter};
1254
1278
  SharedColor strokeColor{};
1255
1279
  std::vector<SharedColor> strokeColors{};
1256
- Float strokeWidth{0.0};
1280
+ Float strokeWidth{1.0};
1257
1281
  bool tappable{false};
1258
1282
  };
1259
1283
 
package/package.json CHANGED
@@ -5,7 +5,7 @@
5
5
  "main": "src/index.ts",
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.24.9",
8
+ "version": "1.24.11",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",