react-native-maps 1.24.8 → 1.24.10

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.
@@ -16,8 +16,6 @@
16
16
  + (NSDictionary<NSString *, Class<RCTComponentViewProtocol>> *)thirdPartyFabricComponents
17
17
  {
18
18
  return @{
19
- @"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
20
- @"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
21
19
  @"RNMapsGoogleMapView": NSClassFromString(@"RNMapsGoogleMapView"), // react-native-maps
22
20
  @"RNMapsGooglePolygon": NSClassFromString(@"RNMapsGooglePolygonView"), // react-native-maps
23
21
  @"RNMapsMapView": NSClassFromString(@"RNMapsMapView"), // react-native-maps
@@ -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;
@@ -52,6 +55,9 @@ public class RNMapsMarkerManagerDelegate<T extends View, U extends BaseViewManag
52
55
  case "title":
53
56
  mViewManager.setTitle(view, value == null ? null : (String) value);
54
57
  break;
58
+ case "tracksViewChanges":
59
+ mViewManager.setTracksViewChanges(view, value == null ? true : (boolean) value);
60
+ break;
55
61
  case "identifier":
56
62
  mViewManager.setIdentifier(view, value == null ? null : (String) value);
57
63
  break;
@@ -19,10 +19,12 @@ 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);
25
26
  void setTitle(T view, @Nullable String value);
27
+ void setTracksViewChanges(T view, boolean value);
26
28
  void setIdentifier(T view, @Nullable String value);
27
29
  void setIsPreselected(T view, boolean value);
28
30
  void setOpacity(T view, double 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);
@@ -182,6 +186,11 @@ public class MarkerManager extends ViewGroupManager<MapMarker> implements RNMaps
182
186
  view.setUpdated(true);
183
187
  }
184
188
 
189
+ @Override
190
+ public void setTracksViewChanges(MapMarker view, boolean value) {
191
+ view.setTracksViewChanges(value);
192
+ }
193
+
185
194
  @Override
186
195
  public void setIdentifier(MapMarker view, @Nullable String value) {
187
196
  view.setIdentifier(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
+ }
@@ -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,10 +154,12 @@ 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})),
159
161
  title(convertRawProp(context, rawProps, "title", sourceProps.title, {})),
162
+ tracksViewChanges(convertRawProp(context, rawProps, "tracksViewChanges", sourceProps.tracksViewChanges, {true})),
160
163
  identifier(convertRawProp(context, rawProps, "identifier", sourceProps.identifier, {})),
161
164
  isPreselected(convertRawProp(context, rawProps, "isPreselected", sourceProps.isPreselected, {false})),
162
165
  opacity(convertRawProp(context, rawProps, "opacity", sourceProps.opacity, {1.0})),
@@ -188,7 +191,7 @@ RNMapsPolylineProps::RNMapsPolylineProps(
188
191
  lineJoin(convertRawProp(context, rawProps, "lineJoin", sourceProps.lineJoin, {RNMapsPolylineLineJoin::Miter})),
189
192
  strokeColor(convertRawProp(context, rawProps, "strokeColor", sourceProps.strokeColor, {})),
190
193
  strokeColors(convertRawProp(context, rawProps, "strokeColors", sourceProps.strokeColors, {})),
191
- strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {0.0})),
194
+ strokeWidth(convertRawProp(context, rawProps, "strokeWidth", sourceProps.strokeWidth, {1.0})),
192
195
  tappable(convertRawProp(context, rawProps, "tappable", sourceProps.tappable, {false}))
193
196
  {}
194
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,10 +1104,12 @@ 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};
1087
1111
  std::string title{};
1112
+ bool tracksViewChanges{true};
1088
1113
  std::string identifier{};
1089
1114
  bool isPreselected{false};
1090
1115
  double opacity{1.0};
@@ -1252,7 +1277,7 @@ class RNMapsPolylineProps final : public ViewProps {
1252
1277
  RNMapsPolylineLineJoin lineJoin{RNMapsPolylineLineJoin::Miter};
1253
1278
  SharedColor strokeColor{};
1254
1279
  std::vector<SharedColor> strokeColors{};
1255
- Float strokeWidth{0.0};
1280
+ Float strokeWidth{1.0};
1256
1281
  bool tappable{false};
1257
1282
  };
1258
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.8",
8
+ "version": "1.24.10",
9
9
  "license": "MIT",
10
10
  "scripts": {
11
11
  "lint": "eslint . --max-warnings 0",
@@ -187,6 +187,16 @@ export interface MarkerFabricNativeProps extends ViewProps {
187
187
  */
188
188
  title?: string;
189
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
+
190
200
  /**
191
201
  * A string that can be used to identify this marker.
192
202
  *