react-native-google-maps-plus 1.0.2 → 1.0.3-dev.1

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 (64) hide show
  1. package/README.md +127 -11
  2. package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +239 -112
  3. package/android/src/main/java/com/rngooglemapsplus/MapCircle.kt +29 -0
  4. package/android/src/main/java/com/rngooglemapsplus/MapMarker.kt +6 -5
  5. package/android/src/main/java/com/rngooglemapsplus/MapPolygon.kt +3 -1
  6. package/android/src/main/java/com/rngooglemapsplus/MapPolyline.kt +3 -1
  7. package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +115 -88
  8. package/ios/Color.swift +20 -20
  9. package/ios/GoogleMapViewImpl.swift +194 -139
  10. package/ios/MapCircle.swift +43 -0
  11. package/ios/MapMarker.swift +10 -17
  12. package/ios/MapPolygon.swift +9 -6
  13. package/ios/MapPolyline.swift +9 -7
  14. package/ios/PermissionHandler.swift +1 -1
  15. package/ios/RNGoogleMapsPlusModule.swift +1 -1
  16. package/ios/RNGoogleMapsPlusView.swift +148 -105
  17. package/lib/module/types.js.map +1 -1
  18. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts +17 -12
  19. package/lib/typescript/src/RNGoogleMapsPlusView.nitro.d.ts.map +1 -1
  20. package/lib/typescript/src/types.d.ts +21 -3
  21. package/lib/typescript/src/types.d.ts.map +1 -1
  22. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +173 -69
  23. package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.hpp +32 -22
  24. package/nitrogen/generated/android/c++/JRNCircle.hpp +84 -0
  25. package/nitrogen/generated/android/c++/JRNInitialProps.hpp +66 -0
  26. package/nitrogen/generated/android/c++/JRNMapType.hpp +68 -0
  27. package/nitrogen/generated/android/c++/JRNMarker.hpp +4 -4
  28. package/nitrogen/generated/android/c++/JRNPolygon.hpp +8 -4
  29. package/nitrogen/generated/android/c++/JRNPolyline.hpp +8 -4
  30. package/nitrogen/generated/android/c++/views/JHybridRNGoogleMapsPlusViewStateUpdater.cpp +24 -4
  31. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/HybridRNGoogleMapsPlusViewSpec.kt +65 -11
  32. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNCircle.kt +50 -0
  33. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +35 -0
  34. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMapType.kt +24 -0
  35. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNMarker.kt +1 -1
  36. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNPolygon.kt +4 -1
  37. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNPolyline.kt +4 -1
  38. package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt +7 -1
  39. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +188 -45
  40. package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +9 -0
  41. package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +85 -37
  42. package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +41 -16
  43. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec.swift +16 -11
  44. package/nitrogen/generated/ios/swift/HybridRNGoogleMapsPlusViewSpec_cxx.swift +296 -45
  45. package/nitrogen/generated/ios/swift/RNCircle.swift +198 -0
  46. package/nitrogen/generated/ios/swift/RNInitialProps.swift +107 -0
  47. package/nitrogen/generated/ios/swift/RNMapType.swift +52 -0
  48. package/nitrogen/generated/ios/swift/RNMarker.swift +17 -5
  49. package/nitrogen/generated/ios/swift/RNPolygon.swift +40 -5
  50. package/nitrogen/generated/ios/swift/RNPolyline.swift +40 -5
  51. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.cpp +12 -2
  52. package/nitrogen/generated/shared/c++/HybridRNGoogleMapsPlusViewSpec.hpp +45 -26
  53. package/nitrogen/generated/shared/c++/RNCircle.hpp +98 -0
  54. package/nitrogen/generated/shared/c++/RNInitialProps.hpp +78 -0
  55. package/nitrogen/generated/shared/c++/RNMapType.hpp +88 -0
  56. package/nitrogen/generated/shared/c++/RNMarker.hpp +6 -6
  57. package/nitrogen/generated/shared/c++/RNPolygon.hpp +10 -6
  58. package/nitrogen/generated/shared/c++/RNPolyline.hpp +10 -6
  59. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.cpp +92 -32
  60. package/nitrogen/generated/shared/c++/views/HybridRNGoogleMapsPlusViewComponent.hpp +21 -13
  61. package/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +6 -1
  62. package/package.json +5 -5
  63. package/src/RNGoogleMapsPlusView.nitro.ts +19 -11
  64. package/src/types.ts +24 -3
@@ -25,116 +25,136 @@ namespace margelo::nitro::rngooglemapsplus::views {
25
25
  const HybridRNGoogleMapsPlusViewProps& sourceProps,
26
26
  const react::RawProps& rawProps):
27
27
  react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
28
- buildingEnabled([&]() -> CachedProp<bool> {
28
+ initialProps([&]() -> CachedProp<std::optional<RNInitialProps>> {
29
+ try {
30
+ const react::RawValue* rawValue = rawProps.at("initialProps", nullptr, nullptr);
31
+ if (rawValue == nullptr) return sourceProps.initialProps;
32
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
33
+ return CachedProp<std::optional<RNInitialProps>>::fromRawValue(*runtime, value, sourceProps.initialProps);
34
+ } catch (const std::exception& exc) {
35
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.initialProps: ") + exc.what());
36
+ }
37
+ }()),
38
+ buildingEnabled([&]() -> CachedProp<std::optional<bool>> {
29
39
  try {
30
40
  const react::RawValue* rawValue = rawProps.at("buildingEnabled", nullptr, nullptr);
31
41
  if (rawValue == nullptr) return sourceProps.buildingEnabled;
32
42
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
33
- return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.buildingEnabled);
43
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.buildingEnabled);
34
44
  } catch (const std::exception& exc) {
35
45
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.buildingEnabled: ") + exc.what());
36
46
  }
37
47
  }()),
38
- trafficEnabled([&]() -> CachedProp<bool> {
48
+ trafficEnabled([&]() -> CachedProp<std::optional<bool>> {
39
49
  try {
40
50
  const react::RawValue* rawValue = rawProps.at("trafficEnabled", nullptr, nullptr);
41
51
  if (rawValue == nullptr) return sourceProps.trafficEnabled;
42
52
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
43
- return CachedProp<bool>::fromRawValue(*runtime, value, sourceProps.trafficEnabled);
53
+ return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.trafficEnabled);
44
54
  } catch (const std::exception& exc) {
45
55
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.trafficEnabled: ") + exc.what());
46
56
  }
47
57
  }()),
48
- customMapStyle([&]() -> CachedProp<std::string> {
58
+ customMapStyle([&]() -> CachedProp<std::optional<std::string>> {
49
59
  try {
50
60
  const react::RawValue* rawValue = rawProps.at("customMapStyle", nullptr, nullptr);
51
61
  if (rawValue == nullptr) return sourceProps.customMapStyle;
52
62
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
53
- return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.customMapStyle);
63
+ return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.customMapStyle);
54
64
  } catch (const std::exception& exc) {
55
65
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.customMapStyle: ") + exc.what());
56
66
  }
57
67
  }()),
58
- initialCamera([&]() -> CachedProp<RNCamera> {
59
- try {
60
- const react::RawValue* rawValue = rawProps.at("initialCamera", nullptr, nullptr);
61
- if (rawValue == nullptr) return sourceProps.initialCamera;
62
- const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
63
- return CachedProp<RNCamera>::fromRawValue(*runtime, value, sourceProps.initialCamera);
64
- } catch (const std::exception& exc) {
65
- throw std::runtime_error(std::string("RNGoogleMapsPlusView.initialCamera: ") + exc.what());
66
- }
67
- }()),
68
- userInterfaceStyle([&]() -> CachedProp<RNUserInterfaceStyle> {
68
+ userInterfaceStyle([&]() -> CachedProp<std::optional<RNUserInterfaceStyle>> {
69
69
  try {
70
70
  const react::RawValue* rawValue = rawProps.at("userInterfaceStyle", nullptr, nullptr);
71
71
  if (rawValue == nullptr) return sourceProps.userInterfaceStyle;
72
72
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
73
- return CachedProp<RNUserInterfaceStyle>::fromRawValue(*runtime, value, sourceProps.userInterfaceStyle);
73
+ return CachedProp<std::optional<RNUserInterfaceStyle>>::fromRawValue(*runtime, value, sourceProps.userInterfaceStyle);
74
74
  } catch (const std::exception& exc) {
75
75
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.userInterfaceStyle: ") + exc.what());
76
76
  }
77
77
  }()),
78
- minZoomLevel([&]() -> CachedProp<double> {
78
+ minZoomLevel([&]() -> CachedProp<std::optional<double>> {
79
79
  try {
80
80
  const react::RawValue* rawValue = rawProps.at("minZoomLevel", nullptr, nullptr);
81
81
  if (rawValue == nullptr) return sourceProps.minZoomLevel;
82
82
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
83
- return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.minZoomLevel);
83
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.minZoomLevel);
84
84
  } catch (const std::exception& exc) {
85
85
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.minZoomLevel: ") + exc.what());
86
86
  }
87
87
  }()),
88
- maxZoomLevel([&]() -> CachedProp<double> {
88
+ maxZoomLevel([&]() -> CachedProp<std::optional<double>> {
89
89
  try {
90
90
  const react::RawValue* rawValue = rawProps.at("maxZoomLevel", nullptr, nullptr);
91
91
  if (rawValue == nullptr) return sourceProps.maxZoomLevel;
92
92
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
93
- return CachedProp<double>::fromRawValue(*runtime, value, sourceProps.maxZoomLevel);
93
+ return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.maxZoomLevel);
94
94
  } catch (const std::exception& exc) {
95
95
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.maxZoomLevel: ") + exc.what());
96
96
  }
97
97
  }()),
98
- mapPadding([&]() -> CachedProp<RNMapPadding> {
98
+ mapPadding([&]() -> CachedProp<std::optional<RNMapPadding>> {
99
99
  try {
100
100
  const react::RawValue* rawValue = rawProps.at("mapPadding", nullptr, nullptr);
101
101
  if (rawValue == nullptr) return sourceProps.mapPadding;
102
102
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
103
- return CachedProp<RNMapPadding>::fromRawValue(*runtime, value, sourceProps.mapPadding);
103
+ return CachedProp<std::optional<RNMapPadding>>::fromRawValue(*runtime, value, sourceProps.mapPadding);
104
104
  } catch (const std::exception& exc) {
105
105
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.mapPadding: ") + exc.what());
106
106
  }
107
107
  }()),
108
- markers([&]() -> CachedProp<std::vector<RNMarker>> {
108
+ mapType([&]() -> CachedProp<std::optional<RNMapType>> {
109
+ try {
110
+ const react::RawValue* rawValue = rawProps.at("mapType", nullptr, nullptr);
111
+ if (rawValue == nullptr) return sourceProps.mapType;
112
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
+ return CachedProp<std::optional<RNMapType>>::fromRawValue(*runtime, value, sourceProps.mapType);
114
+ } catch (const std::exception& exc) {
115
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.mapType: ") + exc.what());
116
+ }
117
+ }()),
118
+ markers([&]() -> CachedProp<std::optional<std::vector<RNMarker>>> {
109
119
  try {
110
120
  const react::RawValue* rawValue = rawProps.at("markers", nullptr, nullptr);
111
121
  if (rawValue == nullptr) return sourceProps.markers;
112
122
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
113
- return CachedProp<std::vector<RNMarker>>::fromRawValue(*runtime, value, sourceProps.markers);
123
+ return CachedProp<std::optional<std::vector<RNMarker>>>::fromRawValue(*runtime, value, sourceProps.markers);
114
124
  } catch (const std::exception& exc) {
115
125
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.markers: ") + exc.what());
116
126
  }
117
127
  }()),
118
- polygons([&]() -> CachedProp<std::vector<RNPolygon>> {
128
+ polygons([&]() -> CachedProp<std::optional<std::vector<RNPolygon>>> {
119
129
  try {
120
130
  const react::RawValue* rawValue = rawProps.at("polygons", nullptr, nullptr);
121
131
  if (rawValue == nullptr) return sourceProps.polygons;
122
132
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
123
- return CachedProp<std::vector<RNPolygon>>::fromRawValue(*runtime, value, sourceProps.polygons);
133
+ return CachedProp<std::optional<std::vector<RNPolygon>>>::fromRawValue(*runtime, value, sourceProps.polygons);
124
134
  } catch (const std::exception& exc) {
125
135
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.polygons: ") + exc.what());
126
136
  }
127
137
  }()),
128
- polylines([&]() -> CachedProp<std::vector<RNPolyline>> {
138
+ polylines([&]() -> CachedProp<std::optional<std::vector<RNPolyline>>> {
129
139
  try {
130
140
  const react::RawValue* rawValue = rawProps.at("polylines", nullptr, nullptr);
131
141
  if (rawValue == nullptr) return sourceProps.polylines;
132
142
  const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
133
- return CachedProp<std::vector<RNPolyline>>::fromRawValue(*runtime, value, sourceProps.polylines);
143
+ return CachedProp<std::optional<std::vector<RNPolyline>>>::fromRawValue(*runtime, value, sourceProps.polylines);
134
144
  } catch (const std::exception& exc) {
135
145
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.polylines: ") + exc.what());
136
146
  }
137
147
  }()),
148
+ circles([&]() -> CachedProp<std::optional<std::vector<RNCircle>>> {
149
+ try {
150
+ const react::RawValue* rawValue = rawProps.at("circles", nullptr, nullptr);
151
+ if (rawValue == nullptr) return sourceProps.circles;
152
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
153
+ return CachedProp<std::optional<std::vector<RNCircle>>>::fromRawValue(*runtime, value, sourceProps.circles);
154
+ } catch (const std::exception& exc) {
155
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.circles: ") + exc.what());
156
+ }
157
+ }()),
138
158
  onMapError([&]() -> CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>> {
139
159
  try {
140
160
  const react::RawValue* rawValue = rawProps.at("onMapError", nullptr, nullptr);
@@ -195,6 +215,36 @@ namespace margelo::nitro::rngooglemapsplus::views {
195
215
  throw std::runtime_error(std::string("RNGoogleMapsPlusView.onMarkerPress: ") + exc.what());
196
216
  }
197
217
  }()),
218
+ onPolylinePress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
219
+ try {
220
+ const react::RawValue* rawValue = rawProps.at("onPolylinePress", nullptr, nullptr);
221
+ if (rawValue == nullptr) return sourceProps.onPolylinePress;
222
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
223
+ return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onPolylinePress);
224
+ } catch (const std::exception& exc) {
225
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.onPolylinePress: ") + exc.what());
226
+ }
227
+ }()),
228
+ onPolygonPress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
229
+ try {
230
+ const react::RawValue* rawValue = rawProps.at("onPolygonPress", nullptr, nullptr);
231
+ if (rawValue == nullptr) return sourceProps.onPolygonPress;
232
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
233
+ return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onPolygonPress);
234
+ } catch (const std::exception& exc) {
235
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.onPolygonPress: ") + exc.what());
236
+ }
237
+ }()),
238
+ onCirclePress([&]() -> CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> {
239
+ try {
240
+ const react::RawValue* rawValue = rawProps.at("onCirclePress", nullptr, nullptr);
241
+ if (rawValue == nullptr) return sourceProps.onCirclePress;
242
+ const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
243
+ return CachedProp<std::optional<std::function<void(const std::string& /* id */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onCirclePress);
244
+ } catch (const std::exception& exc) {
245
+ throw std::runtime_error(std::string("RNGoogleMapsPlusView.onCirclePress: ") + exc.what());
246
+ }
247
+ }()),
198
248
  onCameraChangeStart([&]() -> CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> {
199
249
  try {
200
250
  const react::RawValue* rawValue = rawProps.at("onCameraChangeStart", nullptr, nullptr);
@@ -238,23 +288,28 @@ namespace margelo::nitro::rngooglemapsplus::views {
238
288
 
239
289
  HybridRNGoogleMapsPlusViewProps::HybridRNGoogleMapsPlusViewProps(const HybridRNGoogleMapsPlusViewProps& other):
240
290
  react::ViewProps(),
291
+ initialProps(other.initialProps),
241
292
  buildingEnabled(other.buildingEnabled),
242
293
  trafficEnabled(other.trafficEnabled),
243
294
  customMapStyle(other.customMapStyle),
244
- initialCamera(other.initialCamera),
245
295
  userInterfaceStyle(other.userInterfaceStyle),
246
296
  minZoomLevel(other.minZoomLevel),
247
297
  maxZoomLevel(other.maxZoomLevel),
248
298
  mapPadding(other.mapPadding),
299
+ mapType(other.mapType),
249
300
  markers(other.markers),
250
301
  polygons(other.polygons),
251
302
  polylines(other.polylines),
303
+ circles(other.circles),
252
304
  onMapError(other.onMapError),
253
305
  onMapReady(other.onMapReady),
254
306
  onLocationUpdate(other.onLocationUpdate),
255
307
  onLocationError(other.onLocationError),
256
308
  onMapPress(other.onMapPress),
257
309
  onMarkerPress(other.onMarkerPress),
310
+ onPolylinePress(other.onPolylinePress),
311
+ onPolygonPress(other.onPolygonPress),
312
+ onCirclePress(other.onCirclePress),
258
313
  onCameraChangeStart(other.onCameraChangeStart),
259
314
  onCameraChange(other.onCameraChange),
260
315
  onCameraChangeComplete(other.onCameraChangeComplete),
@@ -262,23 +317,28 @@ namespace margelo::nitro::rngooglemapsplus::views {
262
317
 
263
318
  bool HybridRNGoogleMapsPlusViewProps::filterObjectKeys(const std::string& propName) {
264
319
  switch (hashString(propName)) {
320
+ case hashString("initialProps"): return true;
265
321
  case hashString("buildingEnabled"): return true;
266
322
  case hashString("trafficEnabled"): return true;
267
323
  case hashString("customMapStyle"): return true;
268
- case hashString("initialCamera"): return true;
269
324
  case hashString("userInterfaceStyle"): return true;
270
325
  case hashString("minZoomLevel"): return true;
271
326
  case hashString("maxZoomLevel"): return true;
272
327
  case hashString("mapPadding"): return true;
328
+ case hashString("mapType"): return true;
273
329
  case hashString("markers"): return true;
274
330
  case hashString("polygons"): return true;
275
331
  case hashString("polylines"): return true;
332
+ case hashString("circles"): return true;
276
333
  case hashString("onMapError"): return true;
277
334
  case hashString("onMapReady"): return true;
278
335
  case hashString("onLocationUpdate"): return true;
279
336
  case hashString("onLocationError"): return true;
280
337
  case hashString("onMapPress"): return true;
281
338
  case hashString("onMarkerPress"): return true;
339
+ case hashString("onPolylinePress"): return true;
340
+ case hashString("onPolygonPress"): return true;
341
+ case hashString("onCirclePress"): return true;
282
342
  case hashString("onCameraChangeStart"): return true;
283
343
  case hashString("onCameraChange"): return true;
284
344
  case hashString("onCameraChangeComplete"): return true;
@@ -16,21 +16,24 @@
16
16
  #include <react/renderer/components/view/ConcreteViewShadowNode.h>
17
17
  #include <react/renderer/components/view/ViewProps.h>
18
18
 
19
+ #include "RNInitialProps.hpp"
20
+ #include <optional>
19
21
  #include <string>
20
- #include "RNCamera.hpp"
21
22
  #include "RNUserInterfaceStyle.hpp"
22
23
  #include "RNMapPadding.hpp"
24
+ #include "RNMapType.hpp"
23
25
  #include "RNMarker.hpp"
24
26
  #include <vector>
25
27
  #include "RNPolygon.hpp"
26
28
  #include "RNPolyline.hpp"
29
+ #include "RNCircle.hpp"
27
30
  #include "RNMapErrorCode.hpp"
28
31
  #include <functional>
29
- #include <optional>
30
32
  #include "RNLocation.hpp"
31
33
  #include "RNLocationErrorCode.hpp"
32
34
  #include "RNLatLng.hpp"
33
35
  #include "RNRegion.hpp"
36
+ #include "RNCamera.hpp"
34
37
  #include <memory>
35
38
  #include "HybridRNGoogleMapsPlusViewSpec.hpp"
36
39
 
@@ -55,23 +58,28 @@ namespace margelo::nitro::rngooglemapsplus::views {
55
58
  const react::RawProps& rawProps);
56
59
 
57
60
  public:
58
- CachedProp<bool> buildingEnabled;
59
- CachedProp<bool> trafficEnabled;
60
- CachedProp<std::string> customMapStyle;
61
- CachedProp<RNCamera> initialCamera;
62
- CachedProp<RNUserInterfaceStyle> userInterfaceStyle;
63
- CachedProp<double> minZoomLevel;
64
- CachedProp<double> maxZoomLevel;
65
- CachedProp<RNMapPadding> mapPadding;
66
- CachedProp<std::vector<RNMarker>> markers;
67
- CachedProp<std::vector<RNPolygon>> polygons;
68
- CachedProp<std::vector<RNPolyline>> polylines;
61
+ CachedProp<std::optional<RNInitialProps>> initialProps;
62
+ CachedProp<std::optional<bool>> buildingEnabled;
63
+ CachedProp<std::optional<bool>> trafficEnabled;
64
+ CachedProp<std::optional<std::string>> customMapStyle;
65
+ CachedProp<std::optional<RNUserInterfaceStyle>> userInterfaceStyle;
66
+ CachedProp<std::optional<double>> minZoomLevel;
67
+ CachedProp<std::optional<double>> maxZoomLevel;
68
+ CachedProp<std::optional<RNMapPadding>> mapPadding;
69
+ CachedProp<std::optional<RNMapType>> mapType;
70
+ CachedProp<std::optional<std::vector<RNMarker>>> markers;
71
+ CachedProp<std::optional<std::vector<RNPolygon>>> polygons;
72
+ CachedProp<std::optional<std::vector<RNPolyline>>> polylines;
73
+ CachedProp<std::optional<std::vector<RNCircle>>> circles;
69
74
  CachedProp<std::optional<std::function<void(RNMapErrorCode /* error */)>>> onMapError;
70
75
  CachedProp<std::optional<std::function<void(bool /* ready */)>>> onMapReady;
71
76
  CachedProp<std::optional<std::function<void(const RNLocation& /* location */)>>> onLocationUpdate;
72
77
  CachedProp<std::optional<std::function<void(RNLocationErrorCode /* error */)>>> onLocationError;
73
78
  CachedProp<std::optional<std::function<void(const RNLatLng& /* coordinate */)>>> onMapPress;
74
79
  CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onMarkerPress;
80
+ CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onPolylinePress;
81
+ CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onPolygonPress;
82
+ CachedProp<std::optional<std::function<void(const std::string& /* id */)>>> onCirclePress;
75
83
  CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> onCameraChangeStart;
76
84
  CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> onCameraChange;
77
85
  CachedProp<std::optional<std::function<void(const RNRegion& /* region */, const RNCamera& /* camera */, bool /* isGesture */)>>> onCameraChangeComplete;
@@ -4,23 +4,28 @@
4
4
  "bubblingEventTypes": {},
5
5
  "directEventTypes": {},
6
6
  "validAttributes": {
7
+ "initialProps": true,
7
8
  "buildingEnabled": true,
8
9
  "trafficEnabled": true,
9
10
  "customMapStyle": true,
10
- "initialCamera": true,
11
11
  "userInterfaceStyle": true,
12
12
  "minZoomLevel": true,
13
13
  "maxZoomLevel": true,
14
14
  "mapPadding": true,
15
+ "mapType": true,
15
16
  "markers": true,
16
17
  "polygons": true,
17
18
  "polylines": true,
19
+ "circles": true,
18
20
  "onMapError": true,
19
21
  "onMapReady": true,
20
22
  "onLocationUpdate": true,
21
23
  "onLocationError": true,
22
24
  "onMapPress": true,
23
25
  "onMarkerPress": true,
26
+ "onPolylinePress": true,
27
+ "onPolygonPress": true,
28
+ "onCirclePress": true,
24
29
  "onCameraChangeStart": true,
25
30
  "onCameraChange": true,
26
31
  "onCameraChangeComplete": true,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-google-maps-plus",
3
- "version": "1.0.2",
3
+ "version": "1.0.3-dev.1",
4
4
  "description": "React-native wrapper for android & IOS google maps sdk",
5
5
  "main": "./lib/module/index.js",
6
6
  "module": "./lib/module/index.js",
@@ -11,17 +11,17 @@
11
11
  "lint": "yarn lint:js && yarn lint:android && yarn lint:ios",
12
12
  "lint:js": "eslint . --max-warnings 0 && yarn prettier --check .",
13
13
  "lint:android": "cd android && ktlint -F ./**/*.kt*",
14
- "lint:ios": "cd ios && swiftlint --quiet",
14
+ "lint:ios": "cd ios && swiftlint --quiet && swiftformat . --lint",
15
15
  "format": "yarn format:js && yarn format:ios && yarn format:android",
16
16
  "format:js": "prettier --write .",
17
- "format:android": "cd android && ktlint ./**/*.kt*",
18
- "format:ios": "cd ios && swiftlint --quiet --fix",
17
+ "format:android": "cd android && ktlint --format ./**/*.kt*",
18
+ "format:ios": "cd ios && swiftformat .",
19
19
  "clean": "del-cli android/build example/android/build example/android/app/build example/ios/build lib",
20
20
  "test": "jest",
21
21
  "git:clean": "git clean -dfX",
22
22
  "release": "semantic-release",
23
23
  "build": "yarn nitrogen && bob build",
24
- "nitrogen": "nitrogen --logLevel=\"debug\" && node scripts/post-script.js",
24
+ "nitrogen": "nitrogen --logLevel=\"debug\" && node scripts/nitrogen-patch.js",
25
25
  "prepare": "bob build"
26
26
  },
27
27
  "keywords": [
@@ -16,26 +16,34 @@ import type {
16
16
  RNRegion,
17
17
  RNLocation,
18
18
  RNMapErrorCode,
19
+ RNMapType,
20
+ RNInitialProps,
21
+ RNCircle,
19
22
  } from './types';
20
23
 
21
24
  export interface RNGoogleMapsPlusViewProps extends HybridViewProps {
22
- buildingEnabled: boolean;
23
- trafficEnabled: boolean;
24
- customMapStyle: string;
25
- initialCamera: RNCamera;
26
- userInterfaceStyle: RNUserInterfaceStyle;
27
- minZoomLevel: number;
28
- maxZoomLevel: number;
29
- mapPadding: RNMapPadding;
30
- markers: RNMarker[];
31
- polygons: RNPolygon[];
32
- polylines: RNPolyline[];
25
+ initialProps?: RNInitialProps;
26
+ buildingEnabled?: boolean;
27
+ trafficEnabled?: boolean;
28
+ customMapStyle?: string;
29
+ userInterfaceStyle?: RNUserInterfaceStyle;
30
+ minZoomLevel?: number;
31
+ maxZoomLevel?: number;
32
+ mapPadding?: RNMapPadding;
33
+ mapType?: RNMapType;
34
+ markers?: RNMarker[];
35
+ polygons?: RNPolygon[];
36
+ polylines?: RNPolyline[];
37
+ circles?: RNCircle[];
33
38
  onMapError?: (error: RNMapErrorCode) => void;
34
39
  onMapReady?: (ready: boolean) => void;
35
40
  onLocationUpdate?: (location: RNLocation) => void;
36
41
  onLocationError?: (error: RNLocationErrorCode) => void;
37
42
  onMapPress?: (coordinate: RNLatLng) => void;
38
43
  onMarkerPress?: (id: string) => void;
44
+ onPolylinePress?: (id: string) => void;
45
+ onPolygonPress?: (id: string) => void;
46
+ onCirclePress?: (id: string) => void;
39
47
  onCameraChangeStart?: (
40
48
  region: RNRegion,
41
49
  camera: RNCamera,
package/src/types.ts CHANGED
@@ -3,6 +3,12 @@ import type { HybridView } from 'react-native-nitro-modules';
3
3
 
4
4
  export type GoogleMapsViewRef = HybridView<RNGoogleMapsPlusViewMethods>;
5
5
 
6
+ export type RNInitialProps = {
7
+ mapId?: string;
8
+ liteMode?: boolean;
9
+ initialCamera?: RNCamera;
10
+ };
11
+
6
12
  export type RNLatLng = { latitude: number; longitude: number };
7
13
 
8
14
  export type RNBoundingBox = { northEast: RNLatLng; southWest: RNLatLng };
@@ -14,6 +20,8 @@ export type RNMapPadding = {
14
20
  right: number;
15
21
  };
16
22
 
23
+ export type RNMapType = 'none' | 'normal' | 'hybrid' | 'satellite' | 'terrain';
24
+
17
25
  export type RNUserInterfaceStyle = 'light' | 'dark' | 'default';
18
26
 
19
27
  export type RNFeatureType = string;
@@ -106,7 +114,7 @@ export type RNLineJoinType = 'miter' | 'round' | 'bevel';
106
114
 
107
115
  export type RNMarker = {
108
116
  id: string;
109
- zIndex: number;
117
+ zIndex?: number;
110
118
  coordinate: RNLatLng;
111
119
  anchor?: RNPosition;
112
120
  width: number;
@@ -116,7 +124,8 @@ export type RNMarker = {
116
124
 
117
125
  export type RNPolygon = {
118
126
  id: string;
119
- zIndex: number;
127
+ zIndex?: number;
128
+ pressable?: boolean;
120
129
  coordinates: RNLatLng[];
121
130
  fillColor?: string;
122
131
  strokeColor?: string;
@@ -125,7 +134,8 @@ export type RNPolygon = {
125
134
 
126
135
  export type RNPolyline = {
127
136
  id: string;
128
- zIndex: number;
137
+ zIndex?: number;
138
+ pressable?: boolean;
129
139
  coordinates: RNLatLng[];
130
140
  lineCap?: RNLineCapType;
131
141
  lineJoin?: RNLineJoinType;
@@ -133,6 +143,17 @@ export type RNPolyline = {
133
143
  width?: number;
134
144
  };
135
145
 
146
+ export type RNCircle = {
147
+ id: string;
148
+ pressable?: boolean;
149
+ zIndex?: number;
150
+ center: RNLatLng;
151
+ radius?: number;
152
+ strokeWidth?: number;
153
+ strokeColor?: string;
154
+ fillColor?: string;
155
+ };
156
+
136
157
  export type RNLocationPermissionResult = {
137
158
  android?: RNAndroidLocationPermissionResult;
138
159
  ios?: RNIOSPermissionResult;