react-native-google-maps-plus 1.7.0-dev.11 → 1.7.0-dev.13
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.
- package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +45 -96
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +2 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/BitmapExtension.kt +35 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/LatLngBoundsExtension.kt +31 -0
- package/ios/GoogleMapViewImpl.swift +24 -39
- package/ios/MapMarkerBuilder.swift +5 -1
- package/ios/RNGoogleMapsPlusView.swift +3 -0
- package/ios/extensions/UIImage+Extension.swift +45 -0
- package/lib/module/types.js.map +1 -1
- package/lib/typescript/src/types.d.ts +1 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JRNInitialProps.hpp +7 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt +6 -3
- package/nitrogen/generated/ios/swift/RNInitialProps.swift +31 -1
- package/nitrogen/generated/shared/c++/RNInitialProps.hpp +6 -2
- package/package.json +1 -1
- package/src/types.ts +1 -0
|
@@ -7,11 +7,9 @@ import PolylineTag
|
|
|
7
7
|
import android.annotation.SuppressLint
|
|
8
8
|
import android.graphics.Bitmap
|
|
9
9
|
import android.location.Location
|
|
10
|
-
import android.util.Base64
|
|
11
10
|
import android.util.Size
|
|
12
11
|
import android.view.View
|
|
13
12
|
import android.widget.FrameLayout
|
|
14
|
-
import androidx.core.graphics.scale
|
|
15
13
|
import com.facebook.react.bridge.LifecycleEventListener
|
|
16
14
|
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
17
15
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -38,6 +36,7 @@ import com.google.android.gms.maps.model.TileOverlay
|
|
|
38
36
|
import com.google.android.gms.maps.model.TileOverlayOptions
|
|
39
37
|
import com.google.maps.android.data.kml.KmlLayer
|
|
40
38
|
import com.margelo.nitro.core.Promise
|
|
39
|
+
import com.rngooglemapsplus.extensions.encode
|
|
41
40
|
import com.rngooglemapsplus.extensions.onUi
|
|
42
41
|
import com.rngooglemapsplus.extensions.onUiSync
|
|
43
42
|
import com.rngooglemapsplus.extensions.toGooglePriority
|
|
@@ -50,12 +49,10 @@ import com.rngooglemapsplus.extensions.toRnCamera
|
|
|
50
49
|
import com.rngooglemapsplus.extensions.toRnLatLng
|
|
51
50
|
import com.rngooglemapsplus.extensions.toRnLocation
|
|
52
51
|
import com.rngooglemapsplus.extensions.toRnRegion
|
|
52
|
+
import com.rngooglemapsplus.extensions.withPaddingPixels
|
|
53
53
|
import idTag
|
|
54
54
|
import tagData
|
|
55
55
|
import java.io.ByteArrayInputStream
|
|
56
|
-
import java.io.ByteArrayOutputStream
|
|
57
|
-
import java.io.File
|
|
58
|
-
import java.io.FileOutputStream
|
|
59
56
|
import java.nio.charset.StandardCharsets
|
|
60
57
|
|
|
61
58
|
class GoogleMapsViewImpl(
|
|
@@ -226,31 +223,31 @@ class GoogleMapsViewImpl(
|
|
|
226
223
|
locationConfig = locationConfig
|
|
227
224
|
|
|
228
225
|
if (pendingMarkers.isNotEmpty()) {
|
|
229
|
-
pendingMarkers.forEach { (id, opts, markerTag) ->
|
|
226
|
+
pendingMarkers.forEach { (id, opts, markerTag) -> addMarkerInternal(id, opts, markerTag) }
|
|
230
227
|
pendingMarkers.clear()
|
|
231
228
|
}
|
|
232
229
|
if (pendingPolylines.isNotEmpty()) {
|
|
233
|
-
pendingPolylines.forEach { (id, opts) ->
|
|
230
|
+
pendingPolylines.forEach { (id, opts) -> addPolylineInternal(id, opts) }
|
|
234
231
|
pendingPolylines.clear()
|
|
235
232
|
}
|
|
236
233
|
if (pendingPolygons.isNotEmpty()) {
|
|
237
|
-
pendingPolygons.forEach { (id, opts) ->
|
|
234
|
+
pendingPolygons.forEach { (id, opts) -> addPolygonInternal(id, opts) }
|
|
238
235
|
pendingPolygons.clear()
|
|
239
236
|
}
|
|
240
237
|
if (pendingCircles.isNotEmpty()) {
|
|
241
|
-
pendingCircles.forEach { (id, opts) ->
|
|
238
|
+
pendingCircles.forEach { (id, opts) -> addCircleInternal(id, opts) }
|
|
242
239
|
pendingCircles.clear()
|
|
243
240
|
}
|
|
244
241
|
if (pendingHeatmaps.isNotEmpty()) {
|
|
245
|
-
pendingHeatmaps.forEach { (id, opts) ->
|
|
242
|
+
pendingHeatmaps.forEach { (id, opts) -> addHeatmapInternal(id, opts) }
|
|
246
243
|
pendingHeatmaps.clear()
|
|
247
244
|
}
|
|
248
245
|
if (pendingKmlLayers.isNotEmpty()) {
|
|
249
|
-
pendingKmlLayers.forEach { (id, str) ->
|
|
246
|
+
pendingKmlLayers.forEach { (id, str) -> addKmlLayerInternal(id, str) }
|
|
250
247
|
pendingKmlLayers.clear()
|
|
251
248
|
}
|
|
252
249
|
if (pendingUrlTilesOverlays.isNotEmpty()) {
|
|
253
|
-
pendingUrlTilesOverlays.forEach { (id, opts) ->
|
|
250
|
+
pendingUrlTilesOverlays.forEach { (id, opts) -> addUrlTileOverlayInternal(id, opts) }
|
|
254
251
|
pendingUrlTilesOverlays.clear()
|
|
255
252
|
}
|
|
256
253
|
}
|
|
@@ -427,56 +424,23 @@ class GoogleMapsViewImpl(
|
|
|
427
424
|
durationMs: Int,
|
|
428
425
|
) = onUi {
|
|
429
426
|
if (coordinates.isEmpty()) return@onUi
|
|
430
|
-
|
|
427
|
+
|
|
428
|
+
val w = mapView?.width ?: 0
|
|
429
|
+
val h = mapView?.height ?: 0
|
|
430
|
+
|
|
431
|
+
val builder = LatLngBounds.builder()
|
|
431
432
|
coordinates.forEach { coord -> builder.include(coord.toLatLng()) }
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
val
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
val h = (mapView?.height ?: 0)
|
|
438
|
-
val w = (mapView?.width ?: 0)
|
|
439
|
-
val latPerPixel = if (h != 0) latSpan / h else 0.0
|
|
440
|
-
val lngPerPixel = if (w != 0) lngSpan / w else 0.0
|
|
441
|
-
|
|
442
|
-
builder.include(
|
|
443
|
-
LatLng(
|
|
444
|
-
bounds.northeast.latitude + (padding.top.dpToPx() * latPerPixel),
|
|
445
|
-
bounds.northeast.longitude,
|
|
446
|
-
),
|
|
447
|
-
)
|
|
448
|
-
builder.include(
|
|
449
|
-
LatLng(
|
|
450
|
-
bounds.southwest.latitude - (padding.bottom.dpToPx() * latPerPixel),
|
|
451
|
-
bounds.southwest.longitude,
|
|
452
|
-
),
|
|
453
|
-
)
|
|
454
|
-
builder.include(
|
|
455
|
-
LatLng(
|
|
456
|
-
bounds.northeast.latitude,
|
|
457
|
-
bounds.northeast.longitude + (padding.right.dpToPx() * lngPerPixel),
|
|
458
|
-
),
|
|
459
|
-
)
|
|
460
|
-
builder.include(
|
|
461
|
-
LatLng(
|
|
462
|
-
bounds.southwest.latitude,
|
|
463
|
-
bounds.southwest.longitude - (padding.left.dpToPx() * lngPerPixel),
|
|
464
|
-
),
|
|
465
|
-
)
|
|
466
|
-
|
|
467
|
-
val paddedBounds = builder.build()
|
|
433
|
+
|
|
434
|
+
val baseBounds = builder.build()
|
|
435
|
+
val paddedBounds = baseBounds.withPaddingPixels(w, h, padding)
|
|
436
|
+
|
|
468
437
|
val adjustedWidth =
|
|
469
438
|
(w - padding.left.dpToPx() - padding.right.dpToPx()).toInt().coerceAtLeast(0)
|
|
470
439
|
val adjustedHeight =
|
|
471
440
|
(h - padding.top.dpToPx() - padding.bottom.dpToPx()).toInt().coerceAtLeast(0)
|
|
472
441
|
|
|
473
|
-
val update =
|
|
474
|
-
|
|
475
|
-
paddedBounds,
|
|
476
|
-
adjustedWidth,
|
|
477
|
-
adjustedHeight,
|
|
478
|
-
0,
|
|
479
|
-
)
|
|
442
|
+
val update = CameraUpdateFactory.newLatLngBounds(paddedBounds, adjustedWidth, adjustedHeight, 0)
|
|
443
|
+
|
|
480
444
|
if (animated) {
|
|
481
445
|
googleMap?.animateCamera(update, durationMs, null)
|
|
482
446
|
} else {
|
|
@@ -512,30 +476,9 @@ class GoogleMapsViewImpl(
|
|
|
512
476
|
val promise = Promise<String?>()
|
|
513
477
|
onUi {
|
|
514
478
|
googleMap?.snapshot { bitmap ->
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
return@snapshot
|
|
519
|
-
}
|
|
520
|
-
val scaledBitmap = size?.let { bitmap.scale(it.width, it.height) } ?: bitmap
|
|
521
|
-
val output = ByteArrayOutputStream()
|
|
522
|
-
scaledBitmap.compress(compressFormat, (quality * 100).toInt().coerceIn(0, 100), output)
|
|
523
|
-
val bytes = output.toByteArray()
|
|
524
|
-
|
|
525
|
-
if (resultIsFile) {
|
|
526
|
-
val file = File(context.cacheDir, "map_snapshot_${System.currentTimeMillis()}.$format")
|
|
527
|
-
FileOutputStream(file).use { it.write(bytes) }
|
|
528
|
-
promise.resolve(file.absolutePath)
|
|
529
|
-
} else {
|
|
530
|
-
val base64 = Base64.encodeToString(bytes, Base64.NO_WRAP)
|
|
531
|
-
promise.resolve("data:image/$format;base64,$base64")
|
|
532
|
-
}
|
|
533
|
-
|
|
534
|
-
if (scaledBitmap !== bitmap) scaledBitmap.recycle()
|
|
535
|
-
bitmap.recycle()
|
|
536
|
-
} catch (_: Exception) {
|
|
537
|
-
promise.resolve(null)
|
|
538
|
-
}
|
|
479
|
+
bitmap
|
|
480
|
+
?.encode(context, size, format, compressFormat, quality, resultIsFile)
|
|
481
|
+
?.let(promise::resolve) ?: promise.resolve(null)
|
|
539
482
|
}
|
|
540
483
|
}
|
|
541
484
|
return promise
|
|
@@ -552,10 +495,10 @@ class GoogleMapsViewImpl(
|
|
|
552
495
|
}
|
|
553
496
|
|
|
554
497
|
markersById.remove(id)?.remove()
|
|
555
|
-
|
|
498
|
+
addMarkerInternal(id, opts, markerTag)
|
|
556
499
|
}
|
|
557
500
|
|
|
558
|
-
private fun
|
|
501
|
+
private fun addMarkerInternal(
|
|
559
502
|
id: String,
|
|
560
503
|
opts: MarkerOptions,
|
|
561
504
|
markerTag: MarkerTag,
|
|
@@ -603,10 +546,10 @@ class GoogleMapsViewImpl(
|
|
|
603
546
|
return@onUi
|
|
604
547
|
}
|
|
605
548
|
polylinesById.remove(id)?.remove()
|
|
606
|
-
|
|
549
|
+
addPolylineInternal(id, opts)
|
|
607
550
|
}
|
|
608
551
|
|
|
609
|
-
private fun
|
|
552
|
+
private fun addPolylineInternal(
|
|
610
553
|
id: String,
|
|
611
554
|
opts: PolylineOptions,
|
|
612
555
|
) = onUi {
|
|
@@ -646,10 +589,10 @@ class GoogleMapsViewImpl(
|
|
|
646
589
|
return@onUi
|
|
647
590
|
}
|
|
648
591
|
polygonsById.remove(id)?.remove()
|
|
649
|
-
|
|
592
|
+
addPolygonInternal(id, opts)
|
|
650
593
|
}
|
|
651
594
|
|
|
652
|
-
private fun
|
|
595
|
+
private fun addPolygonInternal(
|
|
653
596
|
id: String,
|
|
654
597
|
opts: PolygonOptions,
|
|
655
598
|
) = onUi {
|
|
@@ -689,10 +632,10 @@ class GoogleMapsViewImpl(
|
|
|
689
632
|
return@onUi
|
|
690
633
|
}
|
|
691
634
|
circlesById.remove(id)?.remove()
|
|
692
|
-
|
|
635
|
+
addCircleInternal(id, opts)
|
|
693
636
|
}
|
|
694
637
|
|
|
695
|
-
private fun
|
|
638
|
+
private fun addCircleInternal(
|
|
696
639
|
id: String,
|
|
697
640
|
opts: CircleOptions,
|
|
698
641
|
) = onUi {
|
|
@@ -732,10 +675,10 @@ class GoogleMapsViewImpl(
|
|
|
732
675
|
return@onUi
|
|
733
676
|
}
|
|
734
677
|
heatmapsById.remove(id)?.remove()
|
|
735
|
-
|
|
678
|
+
addHeatmapInternal(id, opts)
|
|
736
679
|
}
|
|
737
680
|
|
|
738
|
-
private fun
|
|
681
|
+
private fun addHeatmapInternal(
|
|
739
682
|
id: String,
|
|
740
683
|
opts: TileOverlayOptions,
|
|
741
684
|
) = onUi {
|
|
@@ -753,7 +696,10 @@ class GoogleMapsViewImpl(
|
|
|
753
696
|
|
|
754
697
|
fun clearHeatmaps() =
|
|
755
698
|
onUi {
|
|
756
|
-
heatmapsById.values.forEach {
|
|
699
|
+
heatmapsById.values.forEach {
|
|
700
|
+
it.clearTileCache()
|
|
701
|
+
it.remove()
|
|
702
|
+
}
|
|
757
703
|
heatmapsById.clear()
|
|
758
704
|
pendingHeatmaps.clear()
|
|
759
705
|
}
|
|
@@ -767,10 +713,10 @@ class GoogleMapsViewImpl(
|
|
|
767
713
|
return@onUi
|
|
768
714
|
}
|
|
769
715
|
kmlLayersById.remove(id)?.removeLayerFromMap()
|
|
770
|
-
|
|
716
|
+
addKmlLayerInternal(id, kmlString)
|
|
771
717
|
}
|
|
772
718
|
|
|
773
|
-
private fun
|
|
719
|
+
private fun addKmlLayerInternal(
|
|
774
720
|
id: String,
|
|
775
721
|
kmlString: String,
|
|
776
722
|
) = onUi {
|
|
@@ -805,10 +751,10 @@ class GoogleMapsViewImpl(
|
|
|
805
751
|
return@onUi
|
|
806
752
|
}
|
|
807
753
|
urlTileOverlaysById.remove(id)?.remove()
|
|
808
|
-
|
|
754
|
+
addUrlTileOverlayInternal(id, opts)
|
|
809
755
|
}
|
|
810
756
|
|
|
811
|
-
private fun
|
|
757
|
+
private fun addUrlTileOverlayInternal(
|
|
812
758
|
id: String,
|
|
813
759
|
opts: TileOverlayOptions,
|
|
814
760
|
) = onUi {
|
|
@@ -826,7 +772,10 @@ class GoogleMapsViewImpl(
|
|
|
826
772
|
|
|
827
773
|
fun clearUrlTileOverlays() =
|
|
828
774
|
onUi {
|
|
829
|
-
urlTileOverlaysById.values.forEach {
|
|
775
|
+
urlTileOverlaysById.values.forEach {
|
|
776
|
+
it.clearTileCache()
|
|
777
|
+
it.remove()
|
|
778
|
+
}
|
|
830
779
|
urlTileOverlaysById.clear()
|
|
831
780
|
pendingUrlTilesOverlays.clear()
|
|
832
781
|
}
|
|
@@ -12,6 +12,7 @@ import com.rngooglemapsplus.extensions.markerEquals
|
|
|
12
12
|
import com.rngooglemapsplus.extensions.polygonEquals
|
|
13
13
|
import com.rngooglemapsplus.extensions.polylineEquals
|
|
14
14
|
import com.rngooglemapsplus.extensions.toCameraPosition
|
|
15
|
+
import com.rngooglemapsplus.extensions.toColor
|
|
15
16
|
import com.rngooglemapsplus.extensions.toCompressFormat
|
|
16
17
|
import com.rngooglemapsplus.extensions.toFileExtension
|
|
17
18
|
import com.rngooglemapsplus.extensions.toGoogleMapType
|
|
@@ -48,6 +49,7 @@ class RNGoogleMapsPlusView(
|
|
|
48
49
|
initialProps?.mapId?.let { mapId(it) }
|
|
49
50
|
initialProps?.liteMode?.let { liteMode(it) }
|
|
50
51
|
initialProps?.camera?.let { camera(it.toCameraPosition(current = null)) }
|
|
52
|
+
initialProps?.backgroundColor?.let { backgroundColor(it.toColor()) }
|
|
51
53
|
}
|
|
52
54
|
view.initMapView(options)
|
|
53
55
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
package com.rngooglemapsplus.extensions
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import android.graphics.Bitmap
|
|
5
|
+
import android.util.Base64
|
|
6
|
+
import android.util.Size
|
|
7
|
+
import androidx.core.graphics.scale
|
|
8
|
+
import java.io.ByteArrayOutputStream
|
|
9
|
+
import java.io.File
|
|
10
|
+
import java.io.FileOutputStream
|
|
11
|
+
|
|
12
|
+
fun Bitmap.encode(
|
|
13
|
+
context: Context,
|
|
14
|
+
targetSize: Size?,
|
|
15
|
+
format: String,
|
|
16
|
+
compressFormat: Bitmap.CompressFormat,
|
|
17
|
+
quality: Double,
|
|
18
|
+
asFile: Boolean,
|
|
19
|
+
): String? =
|
|
20
|
+
try {
|
|
21
|
+
targetSize?.let { scale(it.width, it.height) }
|
|
22
|
+
val output = ByteArrayOutputStream()
|
|
23
|
+
compress(compressFormat, (quality * 100).toInt().coerceIn(0, 100), output)
|
|
24
|
+
val bytes = output.toByteArray()
|
|
25
|
+
|
|
26
|
+
if (asFile) {
|
|
27
|
+
val file = File(context.cacheDir, "snapshot_${System.currentTimeMillis()}.$format")
|
|
28
|
+
FileOutputStream(file).use { it.write(bytes) }
|
|
29
|
+
file.absolutePath
|
|
30
|
+
} else {
|
|
31
|
+
"data:image/$format;base64," + Base64.encodeToString(bytes, Base64.NO_WRAP)
|
|
32
|
+
}
|
|
33
|
+
} catch (_: Exception) {
|
|
34
|
+
null
|
|
35
|
+
}
|
|
@@ -1,10 +1,41 @@
|
|
|
1
1
|
package com.rngooglemapsplus.extensions
|
|
2
2
|
|
|
3
|
+
import com.facebook.react.uimanager.PixelUtil.dpToPx
|
|
4
|
+
import com.google.android.gms.maps.model.LatLng
|
|
3
5
|
import com.google.android.gms.maps.model.LatLngBounds
|
|
4
6
|
import com.rngooglemapsplus.RNLatLngBounds
|
|
7
|
+
import com.rngooglemapsplus.RNMapPadding
|
|
5
8
|
|
|
6
9
|
fun LatLngBounds.toRnLatLngBounds(): RNLatLngBounds =
|
|
7
10
|
RNLatLngBounds(
|
|
8
11
|
northeast = northeast.toRnLatLng(),
|
|
9
12
|
southwest = southwest.toRnLatLng(),
|
|
10
13
|
)
|
|
14
|
+
|
|
15
|
+
fun LatLngBounds.withPaddingPixels(
|
|
16
|
+
mapWidthPx: Int,
|
|
17
|
+
mapHeightPx: Int,
|
|
18
|
+
padding: RNMapPadding,
|
|
19
|
+
): LatLngBounds {
|
|
20
|
+
val latSpan = northeast.latitude - southwest.latitude
|
|
21
|
+
val lngSpan = northeast.longitude - southwest.longitude
|
|
22
|
+
if (latSpan == 0.0 && lngSpan == 0.0) return this
|
|
23
|
+
|
|
24
|
+
val latPerPixel = if (mapHeightPx != 0) latSpan / mapHeightPx else 0.0
|
|
25
|
+
val lngPerPixel = if (mapWidthPx != 0) lngSpan / mapWidthPx else 0.0
|
|
26
|
+
|
|
27
|
+
val builder = LatLngBounds.builder()
|
|
28
|
+
builder.include(
|
|
29
|
+
LatLng(
|
|
30
|
+
northeast.latitude + (padding.top.dpToPx() * latPerPixel),
|
|
31
|
+
northeast.longitude + (padding.right.dpToPx() * lngPerPixel),
|
|
32
|
+
),
|
|
33
|
+
)
|
|
34
|
+
builder.include(
|
|
35
|
+
LatLng(
|
|
36
|
+
southwest.latitude - (padding.bottom.dpToPx() * latPerPixel),
|
|
37
|
+
southwest.longitude - (padding.left.dpToPx() * lngPerPixel),
|
|
38
|
+
),
|
|
39
|
+
)
|
|
40
|
+
return builder.build()
|
|
41
|
+
}
|
|
@@ -288,7 +288,7 @@ GMSIndoorDisplayDelegate {
|
|
|
288
288
|
@MainActor
|
|
289
289
|
func showMarkerInfoWindow(id: String) {
|
|
290
290
|
onMain {
|
|
291
|
-
guard let marker =
|
|
291
|
+
guard let marker = self.markersById[id] else { return }
|
|
292
292
|
self.mapView?.selectedMarker = nil
|
|
293
293
|
self.mapView?.selectedMarker = marker
|
|
294
294
|
}
|
|
@@ -399,42 +399,16 @@ GMSIndoorDisplayDelegate {
|
|
|
399
399
|
mapView.layer.render(in: ctx.cgContext)
|
|
400
400
|
}
|
|
401
401
|
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
let data: Data?
|
|
412
|
-
switch imageFormat {
|
|
413
|
-
case .jpeg:
|
|
414
|
-
data = finalImage.jpegData(compressionQuality: quality)
|
|
415
|
-
case .png:
|
|
416
|
-
data = finalImage.pngData()
|
|
417
|
-
}
|
|
418
|
-
|
|
419
|
-
guard let imageData = data else {
|
|
420
|
-
promise.resolve(withResult: nil)
|
|
421
|
-
return
|
|
422
|
-
}
|
|
423
|
-
|
|
424
|
-
if resultIsFile {
|
|
425
|
-
let filename =
|
|
426
|
-
"map_snapshot_\(Int(Date().timeIntervalSince1970)).\(format)"
|
|
427
|
-
let fileURL = URL(fileURLWithPath: NSTemporaryDirectory())
|
|
428
|
-
.appendingPathComponent(filename)
|
|
429
|
-
do {
|
|
430
|
-
try imageData.write(to: fileURL)
|
|
431
|
-
promise.resolve(withResult: fileURL.path)
|
|
432
|
-
} catch {
|
|
433
|
-
promise.resolve(withResult: nil)
|
|
434
|
-
}
|
|
402
|
+
if let result = image.encode(
|
|
403
|
+
targetSize: size,
|
|
404
|
+
format: format,
|
|
405
|
+
imageFormat: imageFormat,
|
|
406
|
+
quality: quality,
|
|
407
|
+
resultIsFile: resultIsFile
|
|
408
|
+
) {
|
|
409
|
+
promise.resolve(withResult: result)
|
|
435
410
|
} else {
|
|
436
|
-
|
|
437
|
-
promise.resolve(withResult: "data:image/\(format);base64,\(base64)")
|
|
411
|
+
promise.resolve(withResult: nil)
|
|
438
412
|
}
|
|
439
413
|
}
|
|
440
414
|
|
|
@@ -600,7 +574,10 @@ GMSIndoorDisplayDelegate {
|
|
|
600
574
|
|
|
601
575
|
@MainActor
|
|
602
576
|
func removeHeatmap(id: String) {
|
|
603
|
-
heatmapsById.removeValue(forKey: id).map {
|
|
577
|
+
heatmapsById.removeValue(forKey: id).map {
|
|
578
|
+
$0.clearTileCache()
|
|
579
|
+
$0.map = nil
|
|
580
|
+
}
|
|
604
581
|
}
|
|
605
582
|
|
|
606
583
|
@MainActor
|
|
@@ -634,6 +611,7 @@ GMSIndoorDisplayDelegate {
|
|
|
634
611
|
geometries: parser.placemarks
|
|
635
612
|
)
|
|
636
613
|
renderer.render()
|
|
614
|
+
kmlLayerById[id] = renderer
|
|
637
615
|
}
|
|
638
616
|
}
|
|
639
617
|
|
|
@@ -665,16 +643,23 @@ GMSIndoorDisplayDelegate {
|
|
|
665
643
|
urlTileOverlay: GMSURLTileLayer
|
|
666
644
|
) {
|
|
667
645
|
urlTileOverlay.map = mapView
|
|
646
|
+
urlTileOverlays[id] = urlTileOverlay
|
|
668
647
|
}
|
|
669
648
|
|
|
670
649
|
@MainActor
|
|
671
650
|
func removeUrlTileOverlay(id: String) {
|
|
672
|
-
urlTileOverlays.removeValue(forKey: id).map {
|
|
651
|
+
urlTileOverlays.removeValue(forKey: id).map {
|
|
652
|
+
$0.clearTileCache()
|
|
653
|
+
$0.map = nil
|
|
654
|
+
}
|
|
673
655
|
}
|
|
674
656
|
|
|
675
657
|
@MainActor
|
|
676
658
|
func clearUrlTileOverlay() {
|
|
677
|
-
urlTileOverlays.values.forEach {
|
|
659
|
+
urlTileOverlays.values.forEach {
|
|
660
|
+
$0.clearTileCache()
|
|
661
|
+
$0.map = nil
|
|
662
|
+
}
|
|
678
663
|
urlTileOverlays.removeAll()
|
|
679
664
|
pendingUrlTileOverlays.removeAll()
|
|
680
665
|
}
|
|
@@ -19,7 +19,10 @@ final class MapMarkerBuilder {
|
|
|
19
19
|
marker.icon = icon
|
|
20
20
|
m.title.map { marker.title = $0 }
|
|
21
21
|
m.snippet.map { marker.snippet = $0 }
|
|
22
|
-
m.opacity.map {
|
|
22
|
+
m.opacity.map {
|
|
23
|
+
marker.opacity = Float($0)
|
|
24
|
+
marker.iconView?.alpha = CGFloat($0)
|
|
25
|
+
}
|
|
23
26
|
m.flat.map { marker.isFlat = $0 }
|
|
24
27
|
m.draggable.map { marker.isDraggable = $0 }
|
|
25
28
|
m.rotation.map { marker.rotation = $0 }
|
|
@@ -187,6 +190,7 @@ final class MapMarkerBuilder {
|
|
|
187
190
|
iconCache.removeAllObjects()
|
|
188
191
|
}
|
|
189
192
|
|
|
193
|
+
@MainActor
|
|
190
194
|
func buildInfoWindow(iconSvg: RNMarkerSvg?) -> UIImageView? {
|
|
191
195
|
guard let iconSvg = iconSvg else {
|
|
192
196
|
return nil
|
|
@@ -41,6 +41,9 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
41
41
|
initialProps?.camera.map {
|
|
42
42
|
options.camera = $0.toGMSCameraPosition(current: nil)
|
|
43
43
|
}
|
|
44
|
+
initialProps?.backgroundColor.map {
|
|
45
|
+
options.backgroundColor = $0.toUIColor()
|
|
46
|
+
}
|
|
44
47
|
impl.initMapView(googleMapOptions: options)
|
|
45
48
|
}
|
|
46
49
|
}
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import UIKit
|
|
2
|
+
|
|
3
|
+
extension UIImage {
|
|
4
|
+
func encode(
|
|
5
|
+
targetSize: CGSize? = nil,
|
|
6
|
+
format: String = "png",
|
|
7
|
+
imageFormat: ImageFormat = .png,
|
|
8
|
+
quality: CGFloat = 1.0,
|
|
9
|
+
resultIsFile: Bool = false
|
|
10
|
+
) -> String? {
|
|
11
|
+
var imageToEncode = self
|
|
12
|
+
|
|
13
|
+
if let targetSize = targetSize {
|
|
14
|
+
UIGraphicsBeginImageContextWithOptions(targetSize, false, 0.0)
|
|
15
|
+
self.draw(in: CGRect(origin: .zero, size: targetSize))
|
|
16
|
+
imageToEncode = UIGraphicsGetImageFromCurrentImageContext() ?? self
|
|
17
|
+
UIGraphicsEndImageContext()
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
let data: Data?
|
|
21
|
+
switch imageFormat {
|
|
22
|
+
case .jpeg:
|
|
23
|
+
data = imageToEncode.jpegData(compressionQuality: quality)
|
|
24
|
+
case .png:
|
|
25
|
+
data = imageToEncode.pngData()
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
guard let imageData = data else { return nil }
|
|
29
|
+
|
|
30
|
+
if resultIsFile {
|
|
31
|
+
let filename = "snapshot_\(Int(Date().timeIntervalSince1970)).\(format)"
|
|
32
|
+
let fileURL = FileManager.default.temporaryDirectory
|
|
33
|
+
.appendingPathComponent(filename)
|
|
34
|
+
do {
|
|
35
|
+
try imageData.write(to: fileURL)
|
|
36
|
+
return fileURL.path
|
|
37
|
+
} catch {
|
|
38
|
+
return nil
|
|
39
|
+
}
|
|
40
|
+
} else {
|
|
41
|
+
let base64 = imageData.base64EncodedString()
|
|
42
|
+
return "data:image/\(format);base64,\(base64)"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
}
|
package/lib/module/types.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["RNAndroidLocationPriority","RNIOSLocationAccuracy","RNAndroidLocationPermissionResult","RNIOSPermissionResult","RNLocationErrorCode","RNMapErrorCode"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;
|
|
1
|
+
{"version":3,"names":["RNAndroidLocationPriority","RNIOSLocationAccuracy","RNAndroidLocationPermissionResult","RNIOSPermissionResult","RNLocationErrorCode","RNMapErrorCode"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAmEA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;;AAIA;AACA;AACA;;AAyKA,WAAYA,yBAAyB,0BAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAzBA,yBAAyB,CAAzBA,yBAAyB;EAAA,OAAzBA,yBAAyB;AAAA;AAYrC,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAYjC,WAAYC,iCAAiC,0BAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAjCA,iCAAiC,CAAjCA,iCAAiC;EAAA,OAAjCA,iCAAiC;AAAA;AAM7C,WAAYC,qBAAqB,0BAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAArBA,qBAAqB,CAArBA,qBAAqB;EAAA,OAArBA,qBAAqB;AAAA;AAoCjC,WAAYC,mBAAmB,0BAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAnBA,mBAAmB,CAAnBA,mBAAmB;EAAA,OAAnBA,mBAAmB;AAAA;AAS/B,WAAYC,cAAc,0BAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAdA,cAAc,CAAdA,cAAc;EAAA,OAAdA,cAAc;AAAA","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;AAExE,MAAM,MAAM,cAAc,GAAG;IAC3B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,MAAM,CAAC,EAAE,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,8BAA8B,CAAC;AAChF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,4BAA4B,CAAC;AAE7D,MAAM,MAAM,iBAAiB,GAAG,UAAU,CAAC,2BAA2B,CAAC,CAAC;AAExE,MAAM,MAAM,cAAc,GA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AA4B,CAAC,EAAE,MAAM,CAAC;IACtC,sBAAsB,CAAC,EAAE,MAAM,CAAC;IAChC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB,CAAC;AACF,MAAM,MAAM,aAAa,GAAG;IAC1B,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,CAAC;AAEF,oBAAY,mBAAmB;IAC7B,iBAAiB,IAAI;IACrB,oBAAoB,IAAI;IACxB,OAAO,IAAI;IACX,0BAA0B,IAAI;IAC9B,sBAAsB,IAAI;IAC1B,cAAc,KAAK;CACpB;AAED,oBAAY,cAAc;IACxB,qBAAqB,IAAI;IACzB,qBAAqB,IAAI;IACzB,sBAAsB,IAAI;IAC1B,sBAAsB,IAAI;IAC1B,6BAA6B,IAAI;IACjC,qBAAqB,IAAI;IACzB,OAAO,IAAI;CACZ"}
|
|
@@ -42,10 +42,13 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
42
42
|
jni::local_ref<jni::JBoolean> liteMode = this->getFieldValue(fieldLiteMode);
|
|
43
43
|
static const auto fieldCamera = clazz->getField<JRNCamera>("camera");
|
|
44
44
|
jni::local_ref<JRNCamera> camera = this->getFieldValue(fieldCamera);
|
|
45
|
+
static const auto fieldBackgroundColor = clazz->getField<jni::JString>("backgroundColor");
|
|
46
|
+
jni::local_ref<jni::JString> backgroundColor = this->getFieldValue(fieldBackgroundColor);
|
|
45
47
|
return RNInitialProps(
|
|
46
48
|
mapId != nullptr ? std::make_optional(mapId->toStdString()) : std::nullopt,
|
|
47
49
|
liteMode != nullptr ? std::make_optional(static_cast<bool>(liteMode->value())) : std::nullopt,
|
|
48
|
-
camera != nullptr ? std::make_optional(camera->toCpp()) : std::nullopt
|
|
50
|
+
camera != nullptr ? std::make_optional(camera->toCpp()) : std::nullopt,
|
|
51
|
+
backgroundColor != nullptr ? std::make_optional(backgroundColor->toStdString()) : std::nullopt
|
|
49
52
|
);
|
|
50
53
|
}
|
|
51
54
|
|
|
@@ -55,14 +58,15 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
55
58
|
*/
|
|
56
59
|
[[maybe_unused]]
|
|
57
60
|
static jni::local_ref<JRNInitialProps::javaobject> fromCpp(const RNInitialProps& value) {
|
|
58
|
-
using JSignature = JRNInitialProps(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JRNCamera>);
|
|
61
|
+
using JSignature = JRNInitialProps(jni::alias_ref<jni::JString>, jni::alias_ref<jni::JBoolean>, jni::alias_ref<JRNCamera>, jni::alias_ref<jni::JString>);
|
|
59
62
|
static const auto clazz = javaClassStatic();
|
|
60
63
|
static const auto create = clazz->getStaticMethod<JSignature>("fromCpp");
|
|
61
64
|
return create(
|
|
62
65
|
clazz,
|
|
63
66
|
value.mapId.has_value() ? jni::make_jstring(value.mapId.value()) : nullptr,
|
|
64
67
|
value.liteMode.has_value() ? jni::JBoolean::valueOf(value.liteMode.value()) : nullptr,
|
|
65
|
-
value.camera.has_value() ? JRNCamera::fromCpp(value.camera.value()) : nullptr
|
|
68
|
+
value.camera.has_value() ? JRNCamera::fromCpp(value.camera.value()) : nullptr,
|
|
69
|
+
value.backgroundColor.has_value() ? jni::make_jstring(value.backgroundColor.value()) : nullptr
|
|
66
70
|
);
|
|
67
71
|
}
|
|
68
72
|
};
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNInitialProps.kt
CHANGED
|
@@ -26,7 +26,10 @@ data class RNInitialProps(
|
|
|
26
26
|
val liteMode: Boolean?,
|
|
27
27
|
@DoNotStrip
|
|
28
28
|
@Keep
|
|
29
|
-
val camera: RNCamera
|
|
29
|
+
val camera: RNCamera?,
|
|
30
|
+
@DoNotStrip
|
|
31
|
+
@Keep
|
|
32
|
+
val backgroundColor: String?
|
|
30
33
|
) {
|
|
31
34
|
private companion object {
|
|
32
35
|
/**
|
|
@@ -36,8 +39,8 @@ data class RNInitialProps(
|
|
|
36
39
|
@Keep
|
|
37
40
|
@Suppress("unused")
|
|
38
41
|
@JvmStatic
|
|
39
|
-
private fun fromCpp(mapId: String?, liteMode: Boolean?, camera: RNCamera?): RNInitialProps {
|
|
40
|
-
return RNInitialProps(mapId, liteMode, camera)
|
|
42
|
+
private fun fromCpp(mapId: String?, liteMode: Boolean?, camera: RNCamera?, backgroundColor: String?): RNInitialProps {
|
|
43
|
+
return RNInitialProps(mapId, liteMode, camera, backgroundColor)
|
|
41
44
|
}
|
|
42
45
|
}
|
|
43
46
|
}
|
|
@@ -18,7 +18,7 @@ public extension RNInitialProps {
|
|
|
18
18
|
/**
|
|
19
19
|
* Create a new instance of `RNInitialProps`.
|
|
20
20
|
*/
|
|
21
|
-
init(mapId: String?, liteMode: Bool?, camera: RNCamera?) {
|
|
21
|
+
init(mapId: String?, liteMode: Bool?, camera: RNCamera?, backgroundColor: String?) {
|
|
22
22
|
self.init({ () -> bridge.std__optional_std__string_ in
|
|
23
23
|
if let __unwrappedValue = mapId {
|
|
24
24
|
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
@@ -37,6 +37,12 @@ public extension RNInitialProps {
|
|
|
37
37
|
} else {
|
|
38
38
|
return .init()
|
|
39
39
|
}
|
|
40
|
+
}(), { () -> bridge.std__optional_std__string_ in
|
|
41
|
+
if let __unwrappedValue = backgroundColor {
|
|
42
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
43
|
+
} else {
|
|
44
|
+
return .init()
|
|
45
|
+
}
|
|
40
46
|
}())
|
|
41
47
|
}
|
|
42
48
|
|
|
@@ -104,4 +110,28 @@ public extension RNInitialProps {
|
|
|
104
110
|
}()
|
|
105
111
|
}
|
|
106
112
|
}
|
|
113
|
+
|
|
114
|
+
var backgroundColor: String? {
|
|
115
|
+
@inline(__always)
|
|
116
|
+
get {
|
|
117
|
+
return { () -> String? in
|
|
118
|
+
if bridge.has_value_std__optional_std__string_(self.__backgroundColor) {
|
|
119
|
+
let __unwrapped = bridge.get_std__optional_std__string_(self.__backgroundColor)
|
|
120
|
+
return String(__unwrapped)
|
|
121
|
+
} else {
|
|
122
|
+
return nil
|
|
123
|
+
}
|
|
124
|
+
}()
|
|
125
|
+
}
|
|
126
|
+
@inline(__always)
|
|
127
|
+
set {
|
|
128
|
+
self.__backgroundColor = { () -> bridge.std__optional_std__string_ in
|
|
129
|
+
if let __unwrappedValue = newValue {
|
|
130
|
+
return bridge.create_std__optional_std__string_(std.string(__unwrappedValue))
|
|
131
|
+
} else {
|
|
132
|
+
return .init()
|
|
133
|
+
}
|
|
134
|
+
}()
|
|
135
|
+
}
|
|
136
|
+
}
|
|
107
137
|
}
|
|
@@ -40,10 +40,11 @@ namespace margelo::nitro::rngooglemapsplus {
|
|
|
40
40
|
std::optional<std::string> mapId SWIFT_PRIVATE;
|
|
41
41
|
std::optional<bool> liteMode SWIFT_PRIVATE;
|
|
42
42
|
std::optional<RNCamera> camera SWIFT_PRIVATE;
|
|
43
|
+
std::optional<std::string> backgroundColor SWIFT_PRIVATE;
|
|
43
44
|
|
|
44
45
|
public:
|
|
45
46
|
RNInitialProps() = default;
|
|
46
|
-
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<RNCamera> camera): mapId(mapId), liteMode(liteMode), camera(camera) {}
|
|
47
|
+
explicit RNInitialProps(std::optional<std::string> mapId, std::optional<bool> liteMode, std::optional<RNCamera> camera, std::optional<std::string> backgroundColor): mapId(mapId), liteMode(liteMode), camera(camera), backgroundColor(backgroundColor) {}
|
|
47
48
|
};
|
|
48
49
|
|
|
49
50
|
} // namespace margelo::nitro::rngooglemapsplus
|
|
@@ -58,7 +59,8 @@ namespace margelo::nitro {
|
|
|
58
59
|
return margelo::nitro::rngooglemapsplus::RNInitialProps(
|
|
59
60
|
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "mapId")),
|
|
60
61
|
JSIConverter<std::optional<bool>>::fromJSI(runtime, obj.getProperty(runtime, "liteMode")),
|
|
61
|
-
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::fromJSI(runtime, obj.getProperty(runtime, "camera"))
|
|
62
|
+
JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::fromJSI(runtime, obj.getProperty(runtime, "camera")),
|
|
63
|
+
JSIConverter<std::optional<std::string>>::fromJSI(runtime, obj.getProperty(runtime, "backgroundColor"))
|
|
62
64
|
);
|
|
63
65
|
}
|
|
64
66
|
static inline jsi::Value toJSI(jsi::Runtime& runtime, const margelo::nitro::rngooglemapsplus::RNInitialProps& arg) {
|
|
@@ -66,6 +68,7 @@ namespace margelo::nitro {
|
|
|
66
68
|
obj.setProperty(runtime, "mapId", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.mapId));
|
|
67
69
|
obj.setProperty(runtime, "liteMode", JSIConverter<std::optional<bool>>::toJSI(runtime, arg.liteMode));
|
|
68
70
|
obj.setProperty(runtime, "camera", JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::toJSI(runtime, arg.camera));
|
|
71
|
+
obj.setProperty(runtime, "backgroundColor", JSIConverter<std::optional<std::string>>::toJSI(runtime, arg.backgroundColor));
|
|
69
72
|
return obj;
|
|
70
73
|
}
|
|
71
74
|
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
@@ -79,6 +82,7 @@ namespace margelo::nitro {
|
|
|
79
82
|
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "mapId"))) return false;
|
|
80
83
|
if (!JSIConverter<std::optional<bool>>::canConvert(runtime, obj.getProperty(runtime, "liteMode"))) return false;
|
|
81
84
|
if (!JSIConverter<std::optional<margelo::nitro::rngooglemapsplus::RNCamera>>::canConvert(runtime, obj.getProperty(runtime, "camera"))) return false;
|
|
85
|
+
if (!JSIConverter<std::optional<std::string>>::canConvert(runtime, obj.getProperty(runtime, "backgroundColor"))) return false;
|
|
82
86
|
return true;
|
|
83
87
|
}
|
|
84
88
|
};
|
package/package.json
CHANGED