react-native-google-maps-plus 1.4.0 → 1.4.1-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.
- package/android/src/main/java/com/rngooglemapsplus/GoogleMapsViewImpl.kt +41 -144
- package/android/src/main/java/com/rngooglemapsplus/LocationHandler.kt +38 -36
- package/android/src/main/java/com/rngooglemapsplus/MapCircleBuilder.kt +31 -8
- package/android/src/main/java/com/rngooglemapsplus/MapMarkerBuilder.kt +69 -18
- package/android/src/main/java/com/rngooglemapsplus/MapPolygonBuilder.kt +53 -14
- package/android/src/main/java/com/rngooglemapsplus/MapPolylineBuilder.kt.kt +44 -11
- package/android/src/main/java/com/rngooglemapsplus/RNGoogleMapsPlusView.kt +4 -4
- package/android/src/main/java/com/rngooglemapsplus/extensions/CameraPositionExtension.kt +12 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/IntExtension.kt +28 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/LatLngBounds.kt +15 -0
- package/android/src/main/java/com/rngooglemapsplus/extensions/LocationExtension.kt +59 -0
- package/ios/GoogleMapViewImpl.swift +28 -138
- package/ios/LocationHandler.swift +5 -13
- package/ios/MapCircleBuilder.swift +29 -9
- package/ios/MapHelper.swift +20 -0
- package/ios/MapMarkerBuilder.swift +101 -84
- package/ios/MapPolygonBuilder.swift +50 -16
- package/ios/MapPolylineBuilder.swift +31 -15
- package/ios/RNGoogleMapsPlusView.swift +15 -11
- package/ios/extensions/CLError+Extension.swift +14 -0
- package/ios/extensions/CLLocation+Extension.swift +27 -0
- package/ios/extensions/GMSCameraPosition+Extension.swift +12 -0
- package/ios/extensions/GMSCoordinateBounds+Extension.swift +19 -0
- package/ios/extensions/RNMarker+Extension.swift +2 -3
- package/lib/module/GoogleMapsPlus.js +7 -0
- package/lib/module/GoogleMapsPlus.js.map +1 -0
- package/lib/module/index.js +3 -5
- package/lib/module/index.js.map +1 -1
- package/lib/module/types.js.map +1 -1
- package/lib/nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json +44 -0
- package/lib/typescript/src/GoogleMapsPlus.d.ts +5 -0
- package/lib/typescript/src/GoogleMapsPlus.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +3 -3
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +25 -0
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/nitrogen/generated/android/c++/JFunc_void_RNLocation.hpp +6 -0
- package/nitrogen/generated/android/c++/JHybridRNGoogleMapsPlusViewSpec.cpp +8 -0
- package/nitrogen/generated/android/c++/JRNLocation.hpp +32 -2
- package/nitrogen/generated/android/c++/JRNLocationAndroid.hpp +82 -0
- package/nitrogen/generated/android/c++/JRNLocationIOS.hpp +77 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocation.kt +19 -1
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocationAndroid.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/RNLocationIOS.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/rngooglemapsplus/views/HybridRNGoogleMapsPlusViewManager.kt +7 -2
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Bridge.hpp +36 -0
- package/nitrogen/generated/ios/RNGoogleMapsPlus-Swift-Cxx-Umbrella.hpp +6 -0
- package/nitrogen/generated/ios/c++/HybridRNGoogleMapsPlusViewSpecSwift.hpp +6 -0
- package/nitrogen/generated/ios/c++/views/HybridRNGoogleMapsPlusViewComponent.mm +8 -0
- package/nitrogen/generated/ios/swift/RNLocation.swift +92 -2
- package/nitrogen/generated/ios/swift/RNLocationAndroid.swift +215 -0
- package/nitrogen/generated/ios/swift/RNLocationIOS.swift +185 -0
- package/nitrogen/generated/shared/c++/RNLocation.hpp +33 -2
- package/nitrogen/generated/shared/c++/RNLocationAndroid.hpp +104 -0
- package/nitrogen/generated/shared/c++/RNLocationIOS.hpp +99 -0
- package/package.json +6 -13
- package/src/GoogleMapsPlus.tsx +20 -0
- package/src/index.tsx +6 -14
- package/src/types.ts +27 -0
- package/lib/module/package.json +0 -1
- package/lib/typescript/package.json +0 -1
|
@@ -3,13 +3,12 @@ import SVGKit
|
|
|
3
3
|
import UIKit
|
|
4
4
|
|
|
5
5
|
final class MapMarkerBuilder {
|
|
6
|
-
private let iconCache
|
|
6
|
+
private let iconCache: NSCache<NSNumber, UIImage> = {
|
|
7
|
+
let c = NSCache<NSNumber, UIImage>()
|
|
8
|
+
c.countLimit = 512
|
|
9
|
+
return c
|
|
10
|
+
}()
|
|
7
11
|
private var tasks: [String: Task<Void, Never>] = [:]
|
|
8
|
-
private let queue = DispatchQueue(
|
|
9
|
-
label: "map.marker.render",
|
|
10
|
-
qos: .userInitiated,
|
|
11
|
-
attributes: .concurrent
|
|
12
|
-
)
|
|
13
12
|
|
|
14
13
|
func build(_ m: RNMarker, icon: UIImage?) -> GMSMarker {
|
|
15
14
|
let marker = GMSMarker(
|
|
@@ -35,7 +34,8 @@ final class MapMarkerBuilder {
|
|
|
35
34
|
}
|
|
36
35
|
m.zIndex.map { marker.zIndex = Int32($0) }
|
|
37
36
|
|
|
38
|
-
|
|
37
|
+
onMainAsync { [weak marker] in
|
|
38
|
+
try? await Task.sleep(nanoseconds: 250_000_000)
|
|
39
39
|
marker?.tracksViewChanges = false
|
|
40
40
|
}
|
|
41
41
|
|
|
@@ -44,22 +44,41 @@ final class MapMarkerBuilder {
|
|
|
44
44
|
|
|
45
45
|
@MainActor
|
|
46
46
|
func update(_ prev: RNMarker, _ next: RNMarker, _ m: GMSMarker) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
47
|
+
if prev.coordinate.latitude != next.coordinate.latitude
|
|
48
|
+
|| prev.coordinate.longitude != next.coordinate.longitude {
|
|
49
|
+
m.position = next.coordinate.toCLLocationCoordinate2D()
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
if prev.title != next.title {
|
|
53
|
+
m.title = next.title
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
if prev.snippet != next.snippet {
|
|
57
|
+
m.snippet = next.snippet
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
if prev.opacity != next.opacity {
|
|
61
|
+
let opacity = Float(next.opacity ?? 1)
|
|
62
|
+
m.opacity = opacity
|
|
63
|
+
m.iconView?.alpha = CGFloat(opacity)
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if prev.flat != next.flat {
|
|
67
|
+
m.isFlat = next.flat ?? false
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
if prev.draggable != next.draggable {
|
|
71
|
+
m.isDraggable = next.draggable ?? false
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
if prev.rotation != next.rotation {
|
|
75
|
+
m.rotation = next.rotation ?? 0
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if prev.zIndex != next.zIndex {
|
|
79
|
+
m.zIndex = Int32(next.zIndex ?? 0)
|
|
80
|
+
}
|
|
81
|
+
|
|
63
82
|
if !prev.markerStyleEquals(next) {
|
|
64
83
|
buildIconAsync(next.id, next) { img in
|
|
65
84
|
m.tracksViewChanges = true
|
|
@@ -68,14 +87,38 @@ final class MapMarkerBuilder {
|
|
|
68
87
|
if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y {
|
|
69
88
|
m.groundAnchor = CGPoint(
|
|
70
89
|
x: next.anchor?.x ?? 0.5,
|
|
71
|
-
y: next.anchor?.y ??
|
|
90
|
+
y: next.anchor?.y ?? 1
|
|
91
|
+
)
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if prev.infoWindowAnchor?.x != next.infoWindowAnchor?.x
|
|
95
|
+
|| prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y {
|
|
96
|
+
m.infoWindowAnchor = CGPoint(
|
|
97
|
+
x: next.infoWindowAnchor?.x ?? 0.5,
|
|
98
|
+
y: next.infoWindowAnchor?.y ?? 0
|
|
72
99
|
)
|
|
73
100
|
}
|
|
74
101
|
|
|
75
|
-
|
|
102
|
+
onMainAsync { [weak m] in
|
|
103
|
+
try? await Task.sleep(nanoseconds: 250_000_000)
|
|
76
104
|
m?.tracksViewChanges = false
|
|
77
105
|
}
|
|
78
106
|
}
|
|
107
|
+
} else {
|
|
108
|
+
if prev.anchor?.x != next.anchor?.x || prev.anchor?.y != next.anchor?.y {
|
|
109
|
+
m.groundAnchor = CGPoint(
|
|
110
|
+
x: next.anchor?.x ?? 0.5,
|
|
111
|
+
y: next.anchor?.y ?? 1
|
|
112
|
+
)
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
if prev.infoWindowAnchor?.x != next.infoWindowAnchor?.x
|
|
116
|
+
|| prev.infoWindowAnchor?.y != next.infoWindowAnchor?.y {
|
|
117
|
+
m.infoWindowAnchor = CGPoint(
|
|
118
|
+
x: next.infoWindowAnchor?.x ?? 0.5,
|
|
119
|
+
y: next.infoWindowAnchor?.y ?? 0
|
|
120
|
+
)
|
|
121
|
+
}
|
|
79
122
|
}
|
|
80
123
|
}
|
|
81
124
|
|
|
@@ -102,7 +145,8 @@ final class MapMarkerBuilder {
|
|
|
102
145
|
guard let self else { return }
|
|
103
146
|
defer { self.tasks.removeValue(forKey: id) }
|
|
104
147
|
|
|
105
|
-
let
|
|
148
|
+
let scale = UIScreen.main.scale
|
|
149
|
+
let img = await self.renderUIImage(m, scale)
|
|
106
150
|
guard let img, !Task.isCancelled else { return }
|
|
107
151
|
|
|
108
152
|
self.iconCache.setObject(img, forKey: key)
|
|
@@ -130,65 +174,38 @@ final class MapMarkerBuilder {
|
|
|
130
174
|
iconCache.removeAllObjects()
|
|
131
175
|
}
|
|
132
176
|
|
|
133
|
-
private func renderUIImage(_ m: RNMarker) async -> UIImage? {
|
|
134
|
-
guard let iconSvg = m.iconSvg
|
|
135
|
-
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
return await withTaskCancellationHandler(
|
|
139
|
-
operation: {
|
|
140
|
-
await withCheckedContinuation {
|
|
141
|
-
(cont: CheckedContinuation<UIImage?, Never>) in
|
|
142
|
-
queue.async {
|
|
143
|
-
if Task.isCancelled {
|
|
144
|
-
cont.resume(returning: nil)
|
|
145
|
-
return
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
let targetW = max(1, Int(CGFloat(iconSvg.width)))
|
|
149
|
-
let targetH = max(1, Int(CGFloat(iconSvg.height)))
|
|
150
|
-
let size = CGSize(width: targetW, height: targetH)
|
|
151
|
-
|
|
152
|
-
guard
|
|
153
|
-
let data = iconSvg.svgString.data(using: .utf8),
|
|
154
|
-
let svgImg = SVGKImage(data: data)
|
|
155
|
-
else {
|
|
156
|
-
cont.resume(returning: nil)
|
|
157
|
-
return
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
svgImg.size = size
|
|
161
|
-
|
|
162
|
-
if Task.isCancelled {
|
|
163
|
-
cont.resume(returning: nil)
|
|
164
|
-
return
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
guard let base = svgImg.uiImage else {
|
|
168
|
-
cont.resume(returning: nil)
|
|
169
|
-
return
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
let scale = UIScreen.main.scale
|
|
173
|
-
let img: UIImage
|
|
174
|
-
if let cg = base.cgImage {
|
|
175
|
-
img = UIImage(cgImage: cg, scale: scale, orientation: .up)
|
|
176
|
-
} else {
|
|
177
|
-
let fmt = UIGraphicsImageRendererFormat.default()
|
|
178
|
-
fmt.opaque = false
|
|
179
|
-
fmt.scale = scale
|
|
180
|
-
let renderer = UIGraphicsImageRenderer(size: size, format: fmt)
|
|
181
|
-
img = renderer.image { _ in
|
|
182
|
-
base.draw(in: CGRect(origin: .zero, size: size))
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
cont.resume(returning: img)
|
|
187
|
-
}
|
|
188
|
-
}
|
|
177
|
+
private func renderUIImage(_ m: RNMarker, _ scale: CGFloat) async -> UIImage? {
|
|
178
|
+
guard let iconSvg = m.iconSvg,
|
|
179
|
+
let data = iconSvg.svgString.data(using: .utf8)
|
|
180
|
+
else { return nil }
|
|
189
181
|
|
|
190
|
-
|
|
191
|
-
|
|
182
|
+
let size = CGSize(
|
|
183
|
+
width: max(1, CGFloat(iconSvg.width)),
|
|
184
|
+
height: max(1, CGFloat(iconSvg.height))
|
|
192
185
|
)
|
|
186
|
+
|
|
187
|
+
return await Task.detached(priority: .userInitiated) {
|
|
188
|
+
autoreleasepool {
|
|
189
|
+
guard let svgImg = SVGKImage(data: data) else { return nil }
|
|
190
|
+
svgImg.size = size
|
|
191
|
+
|
|
192
|
+
guard !Task.isCancelled else { return nil }
|
|
193
|
+
guard let base = svgImg.uiImage else { return nil }
|
|
194
|
+
|
|
195
|
+
if let cg = base.cgImage {
|
|
196
|
+
return UIImage(cgImage: cg, scale: scale, orientation: .up)
|
|
197
|
+
}
|
|
198
|
+
guard !Task.isCancelled else { return nil }
|
|
199
|
+
let fmt = UIGraphicsImageRendererFormat.default()
|
|
200
|
+
fmt.opaque = false
|
|
201
|
+
fmt.scale = scale
|
|
202
|
+
guard !Task.isCancelled else { return nil }
|
|
203
|
+
let renderer = UIGraphicsImageRenderer(size: size, format: fmt)
|
|
204
|
+
return renderer.image { _ in
|
|
205
|
+
base.draw(in: CGRect(origin: .zero, size: size))
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}.value
|
|
193
209
|
}
|
|
210
|
+
|
|
194
211
|
}
|
|
@@ -28,26 +28,60 @@ final class MapPolygonBuilder {
|
|
|
28
28
|
return pg
|
|
29
29
|
}
|
|
30
30
|
|
|
31
|
-
func update(_ next: RNPolygon, _ pg: GMSPolygon) {
|
|
32
|
-
let
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
31
|
+
func update(_ prev: RNPolygon, _ next: RNPolygon, _ pg: GMSPolygon) {
|
|
32
|
+
let coordsChanged =
|
|
33
|
+
prev.coordinates.count != next.coordinates.count
|
|
34
|
+
|| !zip(prev.coordinates, next.coordinates).allSatisfy {
|
|
35
|
+
$0.latitude == $1.latitude && $0.longitude == $1.longitude
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if coordsChanged {
|
|
39
|
+
let path = GMSMutablePath()
|
|
40
|
+
next.coordinates.forEach { path.add($0.toCLLocationCoordinate2D()) }
|
|
41
|
+
pg.path = path
|
|
37
42
|
}
|
|
38
|
-
pg.path = path
|
|
39
43
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
44
|
+
let prevHoles = prev.holes ?? []
|
|
45
|
+
let nextHoles = next.holes ?? []
|
|
46
|
+
let holesChanged =
|
|
47
|
+
prevHoles.count != nextHoles.count
|
|
48
|
+
|| !zip(prevHoles, nextHoles).allSatisfy { a, b in
|
|
49
|
+
a.coordinates.count == b.coordinates.count
|
|
50
|
+
&& zip(a.coordinates, b.coordinates).allSatisfy {
|
|
51
|
+
$0.latitude == $1.latitude && $0.longitude == $1.longitude
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
if holesChanged {
|
|
56
|
+
pg.holes = nextHoles.map { hole in
|
|
47
57
|
let path = GMSMutablePath()
|
|
48
58
|
hole.coordinates.forEach { path.add($0.toCLLocationCoordinate2D()) }
|
|
49
59
|
return path
|
|
50
|
-
}
|
|
51
|
-
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
if prev.fillColor != next.fillColor {
|
|
64
|
+
pg.fillColor = next.fillColor?.toUIColor() ?? .clear
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
if prev.strokeColor != next.strokeColor {
|
|
68
|
+
pg.strokeColor = next.strokeColor?.toUIColor() ?? .black
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
if prev.strokeWidth != next.strokeWidth {
|
|
72
|
+
pg.strokeWidth = CGFloat(next.strokeWidth ?? 1.0)
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
if prev.pressable != next.pressable {
|
|
76
|
+
pg.isTappable = next.pressable ?? false
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
if prev.geodesic != next.geodesic {
|
|
80
|
+
pg.geodesic = next.geodesic ?? false
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
if prev.zIndex != next.zIndex {
|
|
84
|
+
pg.zIndex = Int32(next.zIndex ?? 0)
|
|
85
|
+
}
|
|
52
86
|
}
|
|
53
87
|
}
|
|
@@ -22,21 +22,37 @@ final class MapPolylineBuilder {
|
|
|
22
22
|
return pl
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
func update(_ next: RNPolyline, _ pl: GMSPolyline) {
|
|
26
|
-
let
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
25
|
+
func update(_ prev: RNPolyline, _ next: RNPolyline, _ pl: GMSPolyline) {
|
|
26
|
+
let coordsChanged =
|
|
27
|
+
prev.coordinates.count != next.coordinates.count
|
|
28
|
+
|| !zip(prev.coordinates, next.coordinates).allSatisfy {
|
|
29
|
+
$0.latitude == $1.latitude && $0.longitude == $1.longitude
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if coordsChanged {
|
|
33
|
+
let path = GMSMutablePath()
|
|
34
|
+
next.coordinates.forEach { path.add($0.toCLLocationCoordinate2D()) }
|
|
35
|
+
pl.path = path
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if prev.width != next.width {
|
|
39
|
+
pl.strokeWidth = CGFloat(next.width ?? 1.0)
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
if prev.color != next.color {
|
|
43
|
+
pl.strokeColor = next.color?.toUIColor() ?? .black
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
if prev.pressable != next.pressable {
|
|
47
|
+
pl.isTappable = next.pressable ?? false
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
if prev.geodesic != next.geodesic {
|
|
51
|
+
pl.geodesic = next.geodesic ?? false
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if prev.zIndex != next.zIndex {
|
|
55
|
+
pl.zIndex = Int32(next.zIndex ?? 0)
|
|
31
56
|
}
|
|
32
|
-
pl.path = path
|
|
33
|
-
|
|
34
|
-
/* lineCap not supported */
|
|
35
|
-
/* lineJoin not supported */
|
|
36
|
-
pl.strokeWidth = CGFloat(next.width ?? 1.0)
|
|
37
|
-
pl.strokeColor = next.color?.toUIColor() ?? .black
|
|
38
|
-
pl.isTappable = next.pressable ?? false
|
|
39
|
-
pl.geodesic = next.geodesic ?? false
|
|
40
|
-
pl.zIndex = Int32(next.zIndex ?? 0)
|
|
41
57
|
}
|
|
42
58
|
}
|
|
@@ -30,21 +30,25 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
30
30
|
)
|
|
31
31
|
}
|
|
32
32
|
|
|
33
|
+
@MainActor
|
|
33
34
|
func afterUpdate() {
|
|
34
35
|
if !propsInitialized {
|
|
35
36
|
propsInitialized = true
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
options.camera = $0.toGMSCameraPosition(current: nil)
|
|
42
|
-
}
|
|
43
|
-
impl.initMapView(googleMapOptions: options)
|
|
37
|
+
let options = GMSMapViewOptions()
|
|
38
|
+
initialProps?.mapId.map { options.mapID = GMSMapID(identifier: $0) }
|
|
39
|
+
initialProps?.liteMode.map { _ in /* not supported */ }
|
|
40
|
+
initialProps?.camera.map {
|
|
41
|
+
options.camera = $0.toGMSCameraPosition(current: nil)
|
|
44
42
|
}
|
|
43
|
+
impl.initMapView(googleMapOptions: options)
|
|
45
44
|
}
|
|
46
45
|
}
|
|
47
46
|
|
|
47
|
+
@MainActor
|
|
48
|
+
func dispose() {
|
|
49
|
+
impl.deinitInternal()
|
|
50
|
+
}
|
|
51
|
+
|
|
48
52
|
@MainActor
|
|
49
53
|
var initialProps: RNInitialProps? {
|
|
50
54
|
didSet {
|
|
@@ -169,7 +173,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
169
173
|
if let prev = prevById[id] {
|
|
170
174
|
if !prev.polylineEquals(next) {
|
|
171
175
|
impl.updatePolyline(id: id) { pl in
|
|
172
|
-
self.polylineBuilder.update(next, pl)
|
|
176
|
+
self.polylineBuilder.update(prev, next, pl)
|
|
173
177
|
}
|
|
174
178
|
}
|
|
175
179
|
} else {
|
|
@@ -201,7 +205,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
201
205
|
if let prev = prevById[id] {
|
|
202
206
|
if !prev.polygonEquals(next) {
|
|
203
207
|
impl.updatePolygon(id: id) { pg in
|
|
204
|
-
self.polygonBuilder.update(next, pg)
|
|
208
|
+
self.polygonBuilder.update(prev, next, pg)
|
|
205
209
|
}
|
|
206
210
|
}
|
|
207
211
|
} else {
|
|
@@ -230,7 +234,7 @@ final class RNGoogleMapsPlusView: HybridRNGoogleMapsPlusViewSpec {
|
|
|
230
234
|
if let prev = prevById[id] {
|
|
231
235
|
if !prev.circleEquals(next) {
|
|
232
236
|
impl.updateCircle(id: id) { circle in
|
|
233
|
-
self.circleBuilder.update(next, circle)
|
|
237
|
+
self.circleBuilder.update(prev, next, circle)
|
|
234
238
|
}
|
|
235
239
|
}
|
|
236
240
|
} else {
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
|
|
3
|
+
extension CLError.Code {
|
|
4
|
+
var toRNLocationErrorCode: RNLocationErrorCode {
|
|
5
|
+
switch self {
|
|
6
|
+
case .denied:
|
|
7
|
+
return .permissionDenied
|
|
8
|
+
case .locationUnknown, .network:
|
|
9
|
+
return .positionUnavailable
|
|
10
|
+
default:
|
|
11
|
+
return .internalError
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import CoreLocation
|
|
2
|
+
|
|
3
|
+
extension CLLocation {
|
|
4
|
+
func toRnLocation() -> RNLocation {
|
|
5
|
+
return RNLocation(
|
|
6
|
+
center: RNLatLng(
|
|
7
|
+
latitude: coordinate.latitude,
|
|
8
|
+
longitude: coordinate.longitude
|
|
9
|
+
),
|
|
10
|
+
altitude: altitude,
|
|
11
|
+
accuracy: horizontalAccuracy,
|
|
12
|
+
bearing: course,
|
|
13
|
+
speed: speed,
|
|
14
|
+
time: timestamp.timeIntervalSince1970 * 1000,
|
|
15
|
+
android: nil,
|
|
16
|
+
ios: RNLocationIOS(
|
|
17
|
+
horizontalAccuracy: horizontalAccuracy,
|
|
18
|
+
verticalAccuracy: verticalAccuracy,
|
|
19
|
+
speedAccuracy: speedAccuracy,
|
|
20
|
+
courseAccuracy: courseAccuracy,
|
|
21
|
+
floor: floor.map { Double($0.level)},
|
|
22
|
+
isFromMockProvider: false,
|
|
23
|
+
timestamp: timestamp.timeIntervalSince1970 * 1000
|
|
24
|
+
)
|
|
25
|
+
)
|
|
26
|
+
}
|
|
27
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import GoogleMaps
|
|
2
|
+
|
|
3
|
+
extension GMSCoordinateBounds {
|
|
4
|
+
func toRNRegion() -> RNRegion {
|
|
5
|
+
let center = CLLocationCoordinate2D(
|
|
6
|
+
latitude: (northEast.latitude + southWest.latitude) / 2.0,
|
|
7
|
+
longitude: (northEast.longitude + southWest.longitude) / 2.0
|
|
8
|
+
)
|
|
9
|
+
|
|
10
|
+
let latDelta = northEast.latitude - southWest.latitude
|
|
11
|
+
let lngDelta = northEast.longitude - southWest.longitude
|
|
12
|
+
|
|
13
|
+
return RNRegion(
|
|
14
|
+
center: center.toRNLatLng(),
|
|
15
|
+
latitudeDelta: latDelta,
|
|
16
|
+
longitudeDelta: lngDelta
|
|
17
|
+
)
|
|
18
|
+
}
|
|
19
|
+
}
|
|
@@ -17,14 +17,13 @@ extension RNMarker {
|
|
|
17
17
|
func markerStyleEquals(_ b: RNMarker) -> Bool {
|
|
18
18
|
iconSvg?.width == b.iconSvg?.width && iconSvg?.height == b.iconSvg?.height
|
|
19
19
|
&& iconSvg?.svgString == b.iconSvg?.svgString
|
|
20
|
-
|
|
21
20
|
}
|
|
22
21
|
|
|
23
|
-
func styleHash() ->
|
|
22
|
+
func styleHash() -> NSNumber {
|
|
24
23
|
var hasher = Hasher()
|
|
25
24
|
hasher.combine(iconSvg?.width)
|
|
26
25
|
hasher.combine(iconSvg?.height)
|
|
27
26
|
hasher.combine(iconSvg?.svgString)
|
|
28
|
-
return
|
|
27
|
+
return NSNumber(value: hasher.finalize())
|
|
29
28
|
}
|
|
30
29
|
}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
import { getHostComponent, NitroModules } from 'react-native-nitro-modules';
|
|
4
|
+
import ViewConfig from '../nitrogen/generated/shared/json/RNGoogleMapsPlusViewConfig.json' with { type: 'json' };
|
|
5
|
+
export const GoogleMapsView = getHostComponent('RNGoogleMapsPlusView', () => ViewConfig);
|
|
6
|
+
export const GoogleMapsModule = NitroModules.createHybridObject('RNGoogleMapsPlusModule');
|
|
7
|
+
//# sourceMappingURL=GoogleMapsPlus.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"names":["getHostComponent","NitroModules","ViewConfig","type","GoogleMapsView","GoogleMapsModule","createHybridObject"],"sourceRoot":"../../src","sources":["GoogleMapsPlus.tsx"],"mappings":";;AAAA,SAASA,gBAAgB,EAAEC,YAAY,QAAQ,4BAA4B;AAE3E,OAAOC,UAAU,MAAM,mEAAmE,QAAQC,IAAI,EAAE,MAAM;AAS9G,OAAO,MAAMC,cAAc,GAAGJ,gBAAgB,CAG5C,sBAAsB,EAAE,MAAME,UAAU,CAAC;AAE3C,OAAO,MAAMG,gBAAgB,GAC3BJ,YAAY,CAACK,kBAAkB,CAC7B,wBACF,CAAC","ignoreList":[]}
|
package/lib/module/index.js
CHANGED
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
export const GoogleMapsView = getHostComponent('RNGoogleMapsPlusView', () => ViewConfig);
|
|
7
|
-
export const GoogleMapsModule = NitroModules.createHybridObject('RNGoogleMapsPlusModule');
|
|
3
|
+
import { GoogleMapsView, GoogleMapsModule } from './GoogleMapsPlus';
|
|
4
|
+
export * from './types';
|
|
5
|
+
export { GoogleMapsView, GoogleMapsModule };
|
|
8
6
|
//# sourceMappingURL=index.js.map
|
package/lib/module/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"names":["
|
|
1
|
+
{"version":3,"names":["GoogleMapsView","GoogleMapsModule"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,cAAc,EAAEC,gBAAgB,QAAQ,kBAAkB;AAOnE,cAAc,SAAS;AAQvB,SAASD,cAAc,EAAEC,gBAAgB","ignoreList":[]}
|
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":";;AAgEA;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;;
|
|
1
|
+
{"version":3,"names":["RNAndroidLocationPriority","RNIOSLocationAccuracy","RNAndroidLocationPermissionResult","RNIOSPermissionResult","RNLocationErrorCode","RNMapErrorCode"],"sourceRoot":"../../src","sources":["types.ts"],"mappings":";;AAgEA;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;;AA6JA,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":[]}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "RNGoogleMapsPlusView",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"initialProps": true,
|
|
8
|
+
"uiSettings": true,
|
|
9
|
+
"myLocationEnabled": true,
|
|
10
|
+
"buildingEnabled": true,
|
|
11
|
+
"trafficEnabled": true,
|
|
12
|
+
"indoorEnabled": true,
|
|
13
|
+
"customMapStyle": true,
|
|
14
|
+
"userInterfaceStyle": true,
|
|
15
|
+
"mapZoomConfig": true,
|
|
16
|
+
"mapPadding": true,
|
|
17
|
+
"mapType": true,
|
|
18
|
+
"markers": true,
|
|
19
|
+
"polygons": true,
|
|
20
|
+
"polylines": true,
|
|
21
|
+
"circles": true,
|
|
22
|
+
"heatmaps": true,
|
|
23
|
+
"kmlLayers": true,
|
|
24
|
+
"locationConfig": true,
|
|
25
|
+
"onMapError": true,
|
|
26
|
+
"onMapReady": true,
|
|
27
|
+
"onLocationUpdate": true,
|
|
28
|
+
"onLocationError": true,
|
|
29
|
+
"onMapPress": true,
|
|
30
|
+
"onMarkerPress": true,
|
|
31
|
+
"onPolylinePress": true,
|
|
32
|
+
"onPolygonPress": true,
|
|
33
|
+
"onCirclePress": true,
|
|
34
|
+
"onMarkerDragStart": true,
|
|
35
|
+
"onMarkerDrag": true,
|
|
36
|
+
"onMarkerDragEnd": true,
|
|
37
|
+
"onIndoorBuildingFocused": true,
|
|
38
|
+
"onIndoorLevelActivated": true,
|
|
39
|
+
"onCameraChangeStart": true,
|
|
40
|
+
"onCameraChange": true,
|
|
41
|
+
"onCameraChangeComplete": true,
|
|
42
|
+
"hybridRef": true
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps } from './RNGoogleMapsPlusView.nitro.js';
|
|
2
|
+
import type { RNGoogleMapsPlusModule } from './RNGoogleMapsPlusModule.nitro.js';
|
|
3
|
+
export declare const GoogleMapsView: import("react-native-nitro-modules").ReactNativeView<RNGoogleMapsPlusViewProps, RNGoogleMapsPlusViewMethods>;
|
|
4
|
+
export declare const GoogleMapsModule: RNGoogleMapsPlusModule;
|
|
5
|
+
//# sourceMappingURL=GoogleMapsPlus.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GoogleMapsPlus.d.ts","sourceRoot":"","sources":["../../../src/GoogleMapsPlus.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,iCAAiC,CAAC;AAEzC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,mCAAmC,CAAC;AAEhF,eAAO,MAAM,cAAc,8GAGgB,CAAC;AAE5C,eAAO,MAAM,gBAAgB,wBAG1B,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
+
import { GoogleMapsView, GoogleMapsModule } from './GoogleMapsPlus';
|
|
1
2
|
import type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps } from './RNGoogleMapsPlusView.nitro';
|
|
2
3
|
import type { RNGoogleMapsPlusModule } from './RNGoogleMapsPlusModule.nitro';
|
|
3
4
|
export * from './types';
|
|
4
|
-
export type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps };
|
|
5
|
-
export
|
|
6
|
-
export declare const GoogleMapsModule: RNGoogleMapsPlusModule;
|
|
5
|
+
export type { RNGoogleMapsPlusViewMethods, RNGoogleMapsPlusViewProps, RNGoogleMapsPlusModule, };
|
|
6
|
+
export { GoogleMapsView, GoogleMapsModule };
|
|
7
7
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpE,OAAO,KAAK,EACV,2BAA2B,EAC3B,yBAAyB,EAC1B,MAAM,8BAA8B,CAAC;AACtC,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,gCAAgC,CAAC;AAE7E,cAAc,SAAS,CAAC;AAExB,YAAY,EACV,2BAA2B,EAC3B,yBAAyB,EACzB,sBAAsB,GACvB,CAAC;AAEF,OAAO,EAAE,cAAc,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -215,7 +215,32 @@ export declare enum RNIOSPermissionResult {
|
|
|
215
215
|
}
|
|
216
216
|
export type RNLocation = {
|
|
217
217
|
center: RNLatLng;
|
|
218
|
+
altitude: number;
|
|
219
|
+
accuracy: number;
|
|
218
220
|
bearing: number;
|
|
221
|
+
speed: number;
|
|
222
|
+
time: number;
|
|
223
|
+
android?: RNLocationAndroid;
|
|
224
|
+
ios?: RNLocationIOS;
|
|
225
|
+
};
|
|
226
|
+
export type RNLocationAndroid = {
|
|
227
|
+
provider?: string | null;
|
|
228
|
+
elapsedRealtimeNanos?: number;
|
|
229
|
+
bearingAccuracyDegrees?: number;
|
|
230
|
+
speedAccuracyMetersPerSecond?: number;
|
|
231
|
+
verticalAccuracyMeters?: number;
|
|
232
|
+
mslAltitudeMeters?: number;
|
|
233
|
+
mslAltitudeAccuracyMeters?: number;
|
|
234
|
+
isMock?: boolean;
|
|
235
|
+
};
|
|
236
|
+
export type RNLocationIOS = {
|
|
237
|
+
horizontalAccuracy?: number;
|
|
238
|
+
verticalAccuracy?: number;
|
|
239
|
+
speedAccuracy?: number;
|
|
240
|
+
courseAccuracy?: number;
|
|
241
|
+
floor?: number | null;
|
|
242
|
+
isFromMockProvider?: boolean;
|
|
243
|
+
timestamp?: number;
|
|
219
244
|
};
|
|
220
245
|
export declare enum RNLocationErrorCode {
|
|
221
246
|
PERMISSION_DENIED = 1,
|