@@ -17,6 +17,7 @@ final class GoogleMapsViewImpl: UIView, GMSMapViewDelegate {
1717 private var pendingMinZoomLevel : Double ?
1818 private var pendingMaxZoomLevel : Double ?
1919 private var pendingMapPadding : RNMapPadding ?
20+ private var pendingMapType : GMSMapViewType ?
2021
2122 private var pendingPolygons : [ ( id: String , polygon: GMSPolygon ) ] = [ ]
2223 private var pendingPolylines : [ ( id: String , polyline: GMSPolyline ) ] = [ ]
@@ -131,6 +132,10 @@ final class GoogleMapsViewImpl: UIView, GMSMapViewDelegate {
131132 mapView. mapStyle = style
132133 }
133134
135+ if let mapType = pendingMapType {
136+ mapView. mapType = mapType
137+ }
138+
134139 if let buildings = pendingBuildingEnabled {
135140 mapView. isBuildingsEnabled = buildings
136141 }
@@ -173,97 +178,105 @@ final class GoogleMapsViewImpl: UIView, GMSMapViewDelegate {
173178
174179 @MainActor
175180 var buildingEnabled : Bool ? {
176- get { mapView. isBuildingsEnabled }
177- set {
178- pendingBuildingEnabled = newValue
179- if let value = newValue {
180- mapView. isBuildingsEnabled = value
181- }
181+ get { mapView. isBuildingsEnabled }
182+ set {
183+ pendingBuildingEnabled = newValue
184+ if let value = newValue {
185+ mapView. isBuildingsEnabled = value
182186 }
187+ }
183188 }
184189
185190 @MainActor
186191 var trafficEnabled : Bool ? {
187- get { mapView. isTrafficEnabled }
188- set {
189- pendingTrafficEnabled = newValue
190- if let value = newValue {
191- mapView. isTrafficEnabled = value
192- }
192+ get { mapView. isTrafficEnabled }
193+ set {
194+ pendingTrafficEnabled = newValue
195+ if let value = newValue {
196+ mapView. isTrafficEnabled = value
193197 }
198+ }
194199 }
195200
196201 @MainActor
197202 var customMapStyle : GMSMapStyle ? {
198- get { pendingCustomMapStyle }
199- set {
200- pendingCustomMapStyle = newValue
201- if let style = newValue {
202- mapView. mapStyle = style
203- }
203+ get { pendingCustomMapStyle }
204+ set {
205+ pendingCustomMapStyle = newValue
206+ if let style = newValue {
207+ mapView. mapStyle = style
204208 }
209+ }
205210 }
206211
207212 @MainActor
208213 var initialCamera : GMSCameraPosition ? {
209- get { pendingInitialCamera }
210- set {
211- pendingInitialCamera = newValue
212- if let camera = newValue, !mapReady {
213- mapView. camera = camera
214- }
214+ get { pendingInitialCamera }
215+ set {
216+ pendingInitialCamera = newValue
217+ if let camera = newValue, !mapReady {
218+ mapView. camera = camera
215219 }
220+ }
216221 }
217222
218223 @MainActor
219224 var userInterfaceStyle : UIUserInterfaceStyle ? {
220- get { pendingUserInterfaceStyle }
221- set {
222- pendingUserInterfaceStyle = newValue
223- if let style = newValue {
224- mapView. overrideUserInterfaceStyle = style
225- }
225+ get { pendingUserInterfaceStyle }
226+ set {
227+ pendingUserInterfaceStyle = newValue
228+ if let style = newValue {
229+ mapView. overrideUserInterfaceStyle = style
226230 }
231+ }
227232 }
228233
229234 @MainActor
230235 var minZoomLevel : Double ? {
231- get { pendingMinZoomLevel }
232- set {
233- pendingMinZoomLevel = newValue
234- if let min = newValue, let max = pendingMaxZoomLevel {
235- mapView. setMinZoom ( Float ( min) , maxZoom: Float ( max) )
236- }
236+ get { pendingMinZoomLevel }
237+ set {
238+ pendingMinZoomLevel = newValue
239+ if let min = newValue, let max = pendingMaxZoomLevel {
240+ mapView. setMinZoom ( Float ( min) , maxZoom: Float ( max) )
237241 }
242+ }
238243 }
239244
240245 @MainActor
241246 var maxZoomLevel : Double ? {
242- get { pendingMaxZoomLevel }
243- set {
244- pendingMaxZoomLevel = newValue
245- if let max = newValue, let min = pendingMinZoomLevel {
246- mapView. setMinZoom ( Float ( min) , maxZoom: Float ( max) )
247- }
247+ get { pendingMaxZoomLevel }
248+ set {
249+ pendingMaxZoomLevel = newValue
250+ if let max = newValue, let min = pendingMinZoomLevel {
251+ mapView. setMinZoom ( Float ( min) , maxZoom: Float ( max) )
248252 }
253+ }
249254 }
250255
251256 @MainActor
252257 var mapPadding : RNMapPadding ? {
253- get { pendingMapPadding }
254- set {
255- pendingMapPadding = newValue
256- if let padding = newValue {
257- mapView. padding = UIEdgeInsets (
258- top: padding. top,
259- left: padding. left,
260- bottom: padding. bottom,
261- right: padding. right
262- )
263- } else {
264- mapView. padding = . zero
265- }
258+ get { pendingMapPadding }
259+ set {
260+ pendingMapPadding = newValue
261+ if let padding = newValue {
262+ mapView. padding = UIEdgeInsets (
263+ top: padding. top,
264+ left: padding. left,
265+ bottom: padding. bottom,
266+ right: padding. right
267+ )
268+ } else {
269+ mapView. padding = . zero
266270 }
271+ }
272+ }
273+
274+ @MainActor var mapType : Int32 ? {
275+ get { pendingMapType. map { Int32 ( $0. rawValue) } }
276+ set {
277+ pendingMapType = GMSMapViewType ( rawValue: UInt ( newValue ?? 1 ) )
278+ mapView. mapType = pendingMapType ?? . normal
279+ }
267280 }
268281
269282 func setCamera( camera: RNCamera , animated: Bool , durationMS: Double ) {
0 commit comments