@complexify/expo-mapbox-navigation 1.0.7 → 1.0.9

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.
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoMapboxNavigation.types.js","sourceRoot":"","sources":["../src/ExpoMapboxNavigation.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ViewStyle, StyleProp } from \"react-native/types\";\n\ntype ProgressEvent = {\n distanceRemaining: number;\n distanceTraveled: number;\n durationRemaining: number;\n fractionTraveled: number;\n};\n\nexport type ExpoMapboxNavigationViewProps = {\n coordinates: Array<{ latitude: number; longitude: number }>;\n waypointIndices?: number[];\n useRouteMatchingApi?: boolean;\n locale?: string;\n routeProfile?: string;\n routeExcludeList?: string[];\n mapStyle?: string;\n mute?: boolean;\n routeColor?: string;\n routeAlternateColor?: string;\n routeCasingColor?: string;\n routeAlternateCasingColor?: string;\n traversedRouteColor?: string;\n maneuverArrowColor?: string;\n onRouteProgressChanged?: (event: { nativeEvent: ProgressEvent }) => void;\n onCancelNavigation?: () => void;\n onWaypointArrival?: (event: {\n nativeEvent: ProgressEvent | undefined;\n }) => void;\n onFinalDestinationArrival?: () => void;\n onRouteChanged?: () => void;\n onUserOffRoute?: () => void;\n onRoutesLoaded?: () => void;\n style?: StyleProp<ViewStyle>;\n \n // Top Banner (1)\n topBannerBackgroundColor?: string;\n topBannerPrimaryTextColor?: string;\n topBannerSecondaryTextColor?: string;\n topBannerDistanceTextColor?: string;\n topBannerSeparatorColor?: string;\n\n // Information Stack (2)\n informationStackBackgroundColor?: string;\n informationStackTextColor?: string;\n\n // Bottom Banner (3)\n bottomBannerBackgroundColor?: string;\n bottomBannerTimeRemainingTextColor?: string;\n bottomBannerDistanceRemainingTextColor?: string;\n bottomBannerArrivalTimeTextColor?: string;\n\n // Resume Button (4)\n resumeButtonBackgroundColor?: string;\n resumeButtonTextColor?: string;\n\n // Speed Limit View (5)\n speedLimitBackgroundColor?: string;\n speedLimitTextColor?: string;\n\n // Floating Stack (6)\n floatingStackBackgroundColor?: string;\n floatingButtonsBackgroundColor?: string;\n\n // Way Name Label (8)\n wayNameViewBackgroundColor?: string;\n wayNameViewTextColor?: string;\n};\n"]}
1
+ {"version":3,"file":"ExpoMapboxNavigation.types.js","sourceRoot":"","sources":["../src/ExpoMapboxNavigation.types.ts"],"names":[],"mappings":"","sourcesContent":["import { ViewStyle, StyleProp } from \"react-native/types\";\n\ntype ProgressEvent = {\n distanceRemaining: number;\n distanceTraveled: number;\n durationRemaining: number;\n fractionTraveled: number;\n};\n\nexport type ExpoMapboxNavigationViewProps = {\n coordinates: Array<{ latitude: number; longitude: number }>;\n waypointIndices?: number[];\n useRouteMatchingApi?: boolean;\n locale?: string;\n routeProfile?: string;\n routeExcludeList?: string[];\n mapStyle?: string;\n mute?: boolean;\n routeColor?: string;\n routeAlternateColor?: string;\n routeCasingColor?: string;\n routeAlternateCasingColor?: string;\n traversedRouteColor?: string;\n maneuverArrowColor?: string;\n onRouteProgressChanged?: (event: { nativeEvent: ProgressEvent }) => void;\n onCancelNavigation?: () => void;\n onWaypointArrival?: (event: {\n nativeEvent: ProgressEvent | undefined;\n }) => void;\n onFinalDestinationArrival?: () => void;\n onRouteChanged?: () => void;\n onUserOffRoute?: () => void;\n onRoutesLoaded?: () => void;\n style?: StyleProp<ViewStyle>;\n\n // Top Banner (1)\n topBannerBackgroundColor?: string;\n topBannerPrimaryTextColor?: string;\n topBannerSecondaryTextColor?: string;\n topBannerDistanceTextColor?: string;\n topBannerSeparatorColor?: string;\n\n // Information Stack (2)\n informationStackBackgroundColor?: string;\n informationStackTextColor?: string;\n\n // Bottom Banner (3)\n bottomBannerBackgroundColor?: string;\n bottomBannerTimeRemainingTextColor?: string;\n bottomBannerDistanceRemainingTextColor?: string;\n bottomBannerArrivalTimeTextColor?: string;\n\n // Resume Button (4)\n resumeButtonBackgroundColor?: string;\n resumeButtonTextColor?: string;\n\n // Speed Limit View (5)\n speedLimitBackgroundColor?: string;\n speedLimitTextColor?: string;\n\n // Floating Stack (6)\n floatingStackBackgroundColor?: string;\n floatingButtonsBackgroundColor?: string;\n\n // Way Name Label (8)\n wayNameViewBackgroundColor?: string;\n wayNameViewTextColor?: string;\n};\n"]}
@@ -138,7 +138,6 @@ public class ExpoMapboxNavigationModule: Module {
138
138
  }
139
139
  }
140
140
 
141
- // Information Stack
142
141
  Prop("informationStackBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
143
142
  if let hexColor = color {
144
143
  view.controller.setInformationStackBackgroundColor(hexColor: hexColor)
@@ -151,20 +150,18 @@ public class ExpoMapboxNavigationModule: Module {
151
150
  }
152
151
  }
153
152
 
154
- // Resume Button
155
- Prop("resumeButtonBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
153
+ Prop("floatingStackBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
156
154
  if let hexColor = color {
157
- view.controller.setResumeButtonBackgroundColor(hexColor: hexColor)
155
+ view.controller.setFloatingStackBackgroundColor(hexColor: hexColor)
158
156
  }
159
157
  }
160
158
 
161
- Prop("resumeButtonTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
159
+ Prop("floatingButtonsBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
162
160
  if let hexColor = color {
163
- view.controller.setResumeButtonTextColor(hexColor: hexColor)
161
+ view.controller.setFloatingButtonsBackgroundColor(hexColor: hexColor)
164
162
  }
165
163
  }
166
164
 
167
- // Speed Limit
168
165
  Prop("speedLimitBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
169
166
  if let hexColor = color {
170
167
  view.controller.setSpeedLimitBackgroundColor(hexColor: hexColor)
@@ -177,31 +174,29 @@ public class ExpoMapboxNavigationModule: Module {
177
174
  }
178
175
  }
179
176
 
180
- // Floating Stack
181
- Prop("floatingStackBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
177
+ Prop("wayNameViewBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
182
178
  if let hexColor = color {
183
- view.controller.setFloatingStackBackgroundColor(hexColor: hexColor)
179
+ view.controller.setWayNameViewBackgroundColor(hexColor: hexColor)
184
180
  }
185
181
  }
186
182
 
187
- Prop("floatingButtonsBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
183
+ Prop("wayNameViewTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
188
184
  if let hexColor = color {
189
- view.controller.setFloatingButtonsBackgroundColor(hexColor: hexColor)
185
+ view.controller.setWayNameViewTextColor(hexColor: hexColor)
190
186
  }
191
187
  }
192
188
 
193
- // Way Name View
194
- Prop("wayNameViewBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
189
+ Prop("resumeButtonBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
195
190
  if let hexColor = color {
196
- view.controller.setWayNameViewBackgroundColor(hexColor: hexColor)
191
+ view.controller.setResumeButtonBackgroundColor(hexColor: hexColor)
197
192
  }
198
193
  }
199
194
 
200
- Prop("wayNameViewTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
195
+ Prop("resumeButtonTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
201
196
  if let hexColor = color {
202
- view.controller.setWayNameViewTextColor(hexColor: hexColor)
197
+ view.controller.setResumeButtonTextColor(hexColor: hexColor)
203
198
  }
204
199
  }
205
200
  }
206
201
  }
207
- }
202
+ }
@@ -73,27 +73,27 @@ class ExpoMapboxNavigationViewController: UIViewController {
73
73
  var currentTraversedRouteColor: UIColor?
74
74
  var currentManeuverArrowColor: UIColor?
75
75
 
76
- var topBannerBackgroundColor: UIColor?
77
- var topBannerPrimaryTextColor: UIColor?
78
- var topBannerSecondaryTextColor: UIColor?
79
- var topBannerDistanceTextColor: UIColor?
80
- var topBannerSeparatorColor: UIColor?
81
-
82
- var bottomBannerBackgroundColor: UIColor?
83
- var bottomBannerTimeRemainingTextColor: UIColor?
84
- var bottomBannerDistanceRemainingTextColor: UIColor?
85
- var bottomBannerArrivalTimeTextColor: UIColor?
86
-
87
- var informationStackBackgroundColor: UIColor?
88
- var informationStackTextColor: UIColor?
89
- var resumeButtonBackgroundColor: UIColor?
90
- var resumeButtonTextColor: UIColor?
91
- var speedLimitBackgroundColor: UIColor?
92
- var speedLimitTextColor: UIColor?
93
- var floatingStackBackgroundColor: UIColor?
94
- var floatingButtonsBackgroundColor: UIColor?
95
- var wayNameViewBackgroundColor: UIColor?
96
- var wayNameViewTextColor: UIColor?
76
+ var currentTopBannerBackgroundColor: UIColor?
77
+ var currentTopBannerPrimaryTextColor: UIColor?
78
+ var currentTopBannerSecondaryTextColor: UIColor?
79
+ var currentTopBannerDistanceTextColor: UIColor?
80
+ var currentTopBannerSeparatorColor: UIColor?
81
+
82
+ var currentBottomBannerBackgroundColor: UIColor?
83
+ var currentBottomBannerTimeRemainingTextColor: UIColor?
84
+ var currentBottomBannerDistanceRemainingTextColor: UIColor?
85
+ var currentBottomBannerArrivalTimeTextColor: UIColor?
86
+
87
+ var currentInformationStackBackgroundColor: UIColor?
88
+ var currentInformationStackTextColor: UIColor?
89
+ var currentFloatingStackBackgroundColor: UIColor?
90
+ var currentFloatingButtonsBackgroundColor: UIColor?
91
+ var currentSpeedLimitBackgroundColor: UIColor?
92
+ var currentSpeedLimitTextColor: UIColor?
93
+ var currentWayNameViewBackgroundColor: UIColor?
94
+ var currentWayNameViewTextColor: UIColor?
95
+ var currentResumeButtonBackgroundColor: UIColor?
96
+ var currentResumeButtonTextColor: UIColor?
97
97
 
98
98
  init() {
99
99
  super.init(nibName: nil, bundle: nil)
@@ -235,98 +235,89 @@ class ExpoMapboxNavigationViewController: UIViewController {
235
235
  }
236
236
 
237
237
  func setTopBannerBackgroundColor(hexColor: String) {
238
- topBannerBackgroundColor = UIColor(hex: hexColor)
239
- update()
238
+ currentTopBannerBackgroundColor = UIColor(hex: hexColor)
240
239
  }
241
240
 
242
241
  func setTopBannerPrimaryTextColor(hexColor: String) {
243
- topBannerPrimaryTextColor = UIColor(hex: hexColor)
244
- update()
242
+ currentTopBannerPrimaryTextColor = UIColor(hex: hexColor)
245
243
  }
246
244
 
247
245
  func setTopBannerSecondaryTextColor(hexColor: String) {
248
- topBannerSecondaryTextColor = UIColor(hex: hexColor)
249
- update()
246
+ currentTopBannerSecondaryTextColor = UIColor(hex: hexColor)
250
247
  }
251
248
 
252
249
  func setTopBannerDistanceTextColor(hexColor: String) {
253
- topBannerDistanceTextColor = UIColor(hex: hexColor)
254
- update()
250
+ currentTopBannerDistanceTextColor = UIColor(hex: hexColor)
255
251
  }
256
252
 
257
253
  func setTopBannerSeparatorColor(hexColor: String) {
258
- topBannerSeparatorColor = UIColor(hex: hexColor)
259
- update()
254
+ currentTopBannerSeparatorColor = UIColor(hex: hexColor)
260
255
  }
261
256
 
262
257
  func setBottomBannerBackgroundColor(hexColor: String) {
263
- bottomBannerBackgroundColor = UIColor(hex: hexColor)
264
- update()
258
+ currentBottomBannerBackgroundColor = UIColor(hex: hexColor)
265
259
  }
266
260
 
267
261
  func setBottomBannerTimeRemainingTextColor(hexColor: String) {
268
- bottomBannerTimeRemainingTextColor = UIColor(hex: hexColor)
269
- update()
262
+ currentBottomBannerTimeRemainingTextColor = UIColor(hex: hexColor)
270
263
  }
271
264
 
272
265
  func setBottomBannerDistanceRemainingTextColor(hexColor: String) {
273
- bottomBannerDistanceRemainingTextColor = UIColor(hex: hexColor)
274
- update()
266
+ currentBottomBannerDistanceRemainingTextColor = UIColor(hex: hexColor)
275
267
  }
276
268
 
277
269
  func setBottomBannerArrivalTimeTextColor(hexColor: String) {
278
- bottomBannerArrivalTimeTextColor = UIColor(hex: hexColor)
279
- update()
270
+ currentBottomBannerArrivalTimeTextColor = UIColor(hex: hexColor)
280
271
  }
281
272
 
282
273
  func setInformationStackBackgroundColor(hexColor: String) {
283
- informationStackBackgroundColor = UIColor(hex: hexColor)
284
- update()
274
+ currentInformationStackBackgroundColor = UIColor(hex: hexColor)
275
+ // Apply color in onRoutesCalculated
285
276
  }
286
277
 
287
278
  func setInformationStackTextColor(hexColor: String) {
288
- informationStackTextColor = UIColor(hex: hexColor)
289
- update()
279
+ currentInformationStackTextColor = UIColor(hex: hexColor)
280
+ // Apply color in onRoutesCalculated
290
281
  }
291
282
 
292
- func setResumeButtonBackgroundColor(hexColor: String) {
293
- resumeButtonBackgroundColor = UIColor(hex: hexColor)
294
- update()
283
+ func setFloatingStackBackgroundColor(hexColor: String) {
284
+ currentFloatingStackBackgroundColor = UIColor(hex: hexColor)
285
+ // Apply color in onRoutesCalculated
295
286
  }
296
287
 
297
- func setResumeButtonTextColor(hexColor: String) {
298
- resumeButtonTextColor = UIColor(hex: hexColor)
299
- update()
288
+ func setFloatingButtonsBackgroundColor(hexColor: String) {
289
+ currentFloatingButtonsBackgroundColor = UIColor(hex: hexColor)
290
+ // Apply color in onRoutesCalculated
300
291
  }
301
292
 
302
293
  func setSpeedLimitBackgroundColor(hexColor: String) {
303
- speedLimitBackgroundColor = UIColor(hex: hexColor)
304
- update()
294
+ currentSpeedLimitBackgroundColor = UIColor(hex: hexColor)
295
+ // Apply color in onRoutesCalculated
305
296
  }
306
297
 
307
298
  func setSpeedLimitTextColor(hexColor: String) {
308
- speedLimitTextColor = UIColor(hex: hexColor)
309
- update()
299
+ currentSpeedLimitTextColor = UIColor(hex: hexColor)
300
+ // Apply color in onRoutesCalculated
310
301
  }
311
302
 
312
- func setFloatingStackBackgroundColor(hexColor: String) {
313
- floatingStackBackgroundColor = UIColor(hex: hexColor)
314
- update()
303
+ func setWayNameViewBackgroundColor(hexColor: String) {
304
+ currentWayNameViewBackgroundColor = UIColor(hex: hexColor)
305
+ // Apply color in onRoutesCalculated
315
306
  }
316
307
 
317
- func setFloatingButtonsBackgroundColor(hexColor: String) {
318
- floatingButtonsBackgroundColor = UIColor(hex: hexColor)
319
- update()
308
+ func setWayNameViewTextColor(hexColor: String) {
309
+ currentWayNameViewTextColor = UIColor(hex: hexColor)
310
+ // Apply color in onRoutesCalculated
320
311
  }
321
312
 
322
- func setWayNameViewBackgroundColor(hexColor: String) {
323
- wayNameViewBackgroundColor = UIColor(hex: hexColor)
324
- update()
313
+ func setResumeButtonBackgroundColor(hexColor: String) {
314
+ currentResumeButtonBackgroundColor = UIColor(hex: hexColor)
315
+ // Apply color in onRoutesCalculated
325
316
  }
326
317
 
327
- func setWayNameViewTextColor(hexColor: String) {
328
- wayNameViewTextColor = UIColor(hex: hexColor)
329
- update()
318
+ func setResumeButtonTextColor(hexColor: String) {
319
+ currentResumeButtonTextColor = UIColor(hex: hexColor)
320
+ // Apply color in onRoutesCalculated
330
321
  }
331
322
 
332
323
  func update(){
@@ -392,28 +383,53 @@ class ExpoMapboxNavigationViewController: UIViewController {
392
383
  onCancelNavigation?()
393
384
  }
394
385
 
395
- func onRoutesCalculated(navigationRoutes: NavigationRoutes) {
386
+ func onRoutesCalculated(navigationRoutes: NavigationRoutes){
396
387
  onRoutesLoaded?()
397
388
 
398
389
  let topBanner = TopBannerViewController()
399
- topBanner.view.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
400
- topBanner.instructionsBannerView.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
401
390
  topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
391
+
392
+ // Apply top banner colors
393
+ if let backgroundColor = currentTopBannerBackgroundColor {
394
+ topBanner.view.backgroundColor = backgroundColor
395
+ }
396
+ if let primaryTextColor = currentTopBannerPrimaryTextColor {
397
+ topBanner.instructionsBannerView.primaryLabel.textColor = primaryTextColor
398
+ }
399
+ if let secondaryTextColor = currentTopBannerSecondaryTextColor {
400
+ topBanner.instructionsBannerView.secondaryLabel.textColor = secondaryTextColor
401
+ }
402
+ if let distanceTextColor = currentTopBannerDistanceTextColor {
403
+ topBanner.instructionsBannerView.distanceLabel.textColor = distanceTextColor
404
+ }
405
+ if let separatorColor = currentTopBannerSeparatorColor {
406
+ topBanner.instructionsBannerView.separatorView.backgroundColor = separatorColor
407
+ }
402
408
 
403
409
  let bottomBanner = BottomBannerViewController()
404
- bottomBanner.view.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
405
410
  bottomBanner.distanceFormatter.locale = currentLocale
406
411
  bottomBanner.dateFormatter.locale = currentLocale
407
412
 
413
+ // Apply bottom banner colors
414
+ if let backgroundColor = currentBottomBannerBackgroundColor {
415
+ bottomBanner.view.backgroundColor = backgroundColor
416
+ }
417
+ if let timeRemainingColor = currentBottomBannerTimeRemainingTextColor {
418
+ bottomBanner.timeRemainingLabel.textColor = timeRemainingColor
419
+ }
420
+ if let distanceRemainingColor = currentBottomBannerDistanceRemainingTextColor {
421
+ bottomBanner.distanceRemainingLabel.textColor = distanceRemainingColor
422
+ }
423
+ if let arrivalTimeColor = currentBottomBannerArrivalTimeTextColor {
424
+ bottomBanner.arrivalTimeLabel.textColor = arrivalTimeColor
425
+ }
426
+
408
427
  let navigationOptions = NavigationOptions(
409
428
  mapboxNavigation: self.mapboxNavigation!,
410
429
  voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
411
430
  eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
412
- styles: nil,
413
431
  topBanner: topBanner,
414
- bottomBanner: bottomBanner,
415
- predictiveCacheManager: nil,
416
- navigationMapView: nil
432
+ bottomBanner: bottomBanner
417
433
  )
418
434
 
419
435
  let navigationViewController = NavigationViewController(
@@ -421,102 +437,66 @@ class ExpoMapboxNavigationViewController: UIViewController {
421
437
  navigationOptions: navigationOptions
422
438
  )
423
439
 
424
- let navigationView = navigationViewController.navigationView
425
-
426
- // 1. Instructions Banner (Top Banner)
427
- let instructionsBanner = navigationView.instructionsBannerView
428
- instructionsBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
429
- instructionsBanner.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
430
- instructionsBanner.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
431
- instructionsBanner.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
432
- instructionsBanner.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
433
-
434
- // 2. Information Stack
435
- let informationStack = navigationView.informationStackView
436
- informationStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
437
- for view in informationStack.arrangedSubviews {
438
- if let label = view as? UILabel {
439
- label.textColor = informationStackTextColor ?? UIColor(hex: "#000000")
440
- }
441
- }
442
-
443
- // 3. Bottom Banner
444
- let bottomBanner = navigationView.bottomBannerView
445
- bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
446
- bottomBanner.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
447
- bottomBanner.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
448
- bottomBanner.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
449
-
450
- // 4. Resume Button
451
- let resumeButton = navigationView.resumeButton
452
- resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
453
- resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: .normal)
454
-
455
- // 5. Speed Limit View
456
- let speedLimitView = navigationView.speedLimitView
457
- speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
458
- if let speedLabel = speedLimitView.valueLabel {
459
- speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
460
- }
461
-
462
- // 6. Floating Stack
463
- let floatingStack = navigationView.floatingStackView
464
- floatingStack.backgroundColor = floatingStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
465
- for button in floatingStack.arrangedSubviews {
466
- if let floatingButton = button as? UIButton {
467
- floatingButton.backgroundColor = floatingButtonsBackgroundColor ?? UIColor(hex: "#FFFFFF")
468
- }
469
- }
470
-
471
- // 7. Navigation Map
472
440
  let navigationMapView = navigationViewController.navigationMapView
473
- navigationMapView.puckType = .puck2D(.navigationDefault)
441
+ navigationMapView!.puckType = .puck2D(.navigationDefault)
474
442
 
475
443
  let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
476
- navigationMapView.mapView.mapboxMap.loadStyle(style!, completion: { _ in
477
- navigationMapView.localizeLabels(locale: self.currentLocale)
478
- do {
479
- try navigationMapView.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
444
+ navigationMapView!.mapView.mapboxMap.loadStyle(style!, completion: { _ in
445
+ navigationMapView!.localizeLabels(locale: self.currentLocale)
446
+ do{
447
+ try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
480
448
  } catch {}
481
449
  })
450
+
451
+
452
+ let cancelButton = navigationViewController.navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self)[0]
453
+ cancelButton.addTarget(self, action: #selector(cancelButtonClicked), for: .touchUpInside)
482
454
 
483
- // Apply map colors
455
+ navigationViewController.delegate = self
456
+ addChild(navigationViewController)
457
+ view.addSubview(navigationViewController.view)
458
+ navigationViewController.view.translatesAutoresizingMaskIntoConstraints = false
459
+ NSLayoutConstraint.activate([
460
+ navigationViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
461
+ navigationViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
462
+ navigationViewController.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0),
463
+ navigationViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
464
+ ])
465
+ didMove(toParent: self)
466
+ mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
467
+
468
+ // Apply custom colors if set
484
469
  if let routeColor = currentRouteColor {
485
- navigationMapView.routeColor = routeColor
470
+ navigationMapView?.routeColor = routeColor
486
471
  }
487
472
  if let alternateColor = currentRouteAlternateColor {
488
- navigationMapView.routeAlternateColor = alternateColor
473
+ navigationMapView?.routeAlternateColor = alternateColor
489
474
  }
490
475
  if let casingColor = currentRouteCasingColor {
491
- navigationMapView.routeCasingColor = casingColor
476
+ navigationMapView?.routeCasingColor = casingColor
492
477
  }
493
478
  if let alternateCasingColor = currentRouteAlternateCasingColor {
494
- navigationMapView.routeAlternateCasingColor = alternateCasingColor
479
+ navigationMapView?.routeAlternateCasingColor = alternateCasingColor
495
480
  }
496
481
  if let traversedColor = currentTraversedRouteColor {
497
- navigationMapView.traversedRouteColor = traversedColor
482
+ navigationMapView?.traversedRouteColor = traversedColor
498
483
  }
499
484
  if let arrowColor = currentManeuverArrowColor {
500
- navigationMapView.maneuverArrowColor = arrowColor
485
+ navigationMapView?.maneuverArrowColor = arrowColor
501
486
  }
502
487
 
503
- // 8. Way Name Label
504
- let wayNameView = navigationView.wayNameView
505
- wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
506
- wayNameView.valueLabel.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
488
+ // Apply custom colors to UI elements
489
+ if let backgroundColor = currentInformationStackBackgroundColor {
490
+ // Apply to information stack background
491
+ navigationViewController.navigationView.informationStackView?.backgroundColor = backgroundColor
492
+ }
507
493
 
508
- navigationViewController.delegate = self
509
- addChild(navigationViewController)
510
- view.addSubview(navigationViewController.view)
511
- navigationViewController.view.translatesAutoresizingMaskIntoConstraints = false
512
- NSLayoutConstraint.activate([
513
- navigationViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
514
- navigationViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
515
- navigationViewController.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0),
516
- navigationViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
517
- ])
518
- navigationViewController.didMove(toParent: self)
519
- mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
494
+ if let textColor = currentInformationStackTextColor {
495
+ // Apply to information stack text
496
+ navigationViewController.navigationView.informationStackView?.tintColor = textColor
497
+ }
498
+
499
+ // Apply other custom colors similarly...
520
500
  }
521
501
  }
522
502
  extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
@@ -553,4 +533,4 @@ extension UIColor {
553
533
 
554
534
  self.init(red: r, green: g, blue: b, alpha: 1.0)
555
535
  }
556
- }
536
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.7",
3
+ "version": "1.0.9",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -32,7 +32,7 @@ export type ExpoMapboxNavigationViewProps = {
32
32
  onUserOffRoute?: () => void;
33
33
  onRoutesLoaded?: () => void;
34
34
  style?: StyleProp<ViewStyle>;
35
-
35
+
36
36
  // Top Banner (1)
37
37
  topBannerBackgroundColor?: string;
38
38
  topBannerPrimaryTextColor?: string;