@complexify/expo-mapbox-navigation 1.0.5 → 1.0.7

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.
@@ -422,84 +422,40 @@ class ExpoMapboxNavigationViewController: UIViewController {
422
422
  )
423
423
 
424
424
  let navigationView = navigationViewController.navigationView
425
-
426
- // Then customize the properly initialized banners
427
- let instructionsView = navigationView.instructionsBannerView
428
- instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
429
- instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
430
- instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
431
- instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
432
-
433
- let bottomView = navigationView.bottomBannerView
434
- bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
435
- bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
436
- bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
437
-
438
- let navigationMapView = navigationView.navigationMapView
439
- navigationMapView!.puckType = .puck2D(.navigationDefault)
440
425
 
441
- let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
442
- navigationMapView!.mapView.mapboxMap.loadStyle(style!, completion: { _ in
443
- navigationMapView!.localizeLabels(locale: self.currentLocale)
444
- do{
445
- try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
446
- } catch {}
447
- })
448
-
449
- let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
450
- cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
451
-
452
- navigationViewController.delegate = self
453
- addChild(navigationViewController)
454
- view.addSubview(navigationViewController.view)
455
- navigationViewController.view.translatesAutoresizingMaskIntoConstraints = false
456
- NSLayoutConstraint.activate([
457
- navigationViewController.view.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 0),
458
- navigationViewController.view.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: 0),
459
- navigationViewController.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0),
460
- navigationViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
461
- ])
462
- navigationViewController.didMove(toParent: self)
463
- mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
464
-
465
- // Apply custom colors if set
466
- if let routeColor = currentRouteColor {
467
- navigationMapView?.routeColor = routeColor
468
- }
469
- if let alternateColor = currentRouteAlternateColor {
470
- navigationMapView?.routeAlternateColor = alternateColor
471
- }
472
- if let casingColor = currentRouteCasingColor {
473
- navigationMapView?.routeCasingColor = casingColor
474
- }
475
- if let alternateCasingColor = currentRouteAlternateCasingColor {
476
- navigationMapView?.routeAlternateCasingColor = alternateCasingColor
477
- }
478
- if let traversedColor = currentTraversedRouteColor {
479
- navigationMapView?.traversedRouteColor = traversedColor
480
- }
481
- if let arrowColor = currentManeuverArrowColor {
482
- navigationMapView?.maneuverArrowColor = arrowColor
483
- }
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")
484
433
 
485
434
  // 2. Information Stack
486
- let infoStack = navigationView.informationStackView
487
- infoStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
488
- for view in infoStack.arrangedSubviews {
435
+ let informationStack = navigationView.informationStackView
436
+ informationStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
437
+ for view in informationStack.arrangedSubviews {
489
438
  if let label = view as? UILabel {
490
439
  label.textColor = informationStackTextColor ?? UIColor(hex: "#000000")
491
440
  }
492
441
  }
493
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
+
494
450
  // 4. Resume Button
495
451
  let resumeButton = navigationView.resumeButton
496
452
  resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
497
- resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: UIControl.State.normal)
453
+ resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: .normal)
498
454
 
499
455
  // 5. Speed Limit View
500
456
  let speedLimitView = navigationView.speedLimitView
501
457
  speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
502
- if let speedLabel = speedLimitView.subviews.first as? UILabel {
458
+ if let speedLabel = speedLimitView.valueLabel {
503
459
  speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
504
460
  }
505
461
 
@@ -512,10 +468,55 @@ class ExpoMapboxNavigationViewController: UIViewController {
512
468
  }
513
469
  }
514
470
 
471
+ // 7. Navigation Map
472
+ let navigationMapView = navigationViewController.navigationMapView
473
+ navigationMapView.puckType = .puck2D(.navigationDefault)
474
+
475
+ 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)
480
+ } catch {}
481
+ })
482
+
483
+ // Apply map colors
484
+ if let routeColor = currentRouteColor {
485
+ navigationMapView.routeColor = routeColor
486
+ }
487
+ if let alternateColor = currentRouteAlternateColor {
488
+ navigationMapView.routeAlternateColor = alternateColor
489
+ }
490
+ if let casingColor = currentRouteCasingColor {
491
+ navigationMapView.routeCasingColor = casingColor
492
+ }
493
+ if let alternateCasingColor = currentRouteAlternateCasingColor {
494
+ navigationMapView.routeAlternateCasingColor = alternateCasingColor
495
+ }
496
+ if let traversedColor = currentTraversedRouteColor {
497
+ navigationMapView.traversedRouteColor = traversedColor
498
+ }
499
+ if let arrowColor = currentManeuverArrowColor {
500
+ navigationMapView.maneuverArrowColor = arrowColor
501
+ }
502
+
515
503
  // 8. Way Name Label
516
504
  let wayNameView = navigationView.wayNameView
517
505
  wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
518
- wayNameView.label.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
506
+ wayNameView.valueLabel.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
507
+
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)
519
520
  }
520
521
  }
521
522
  extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.5",
3
+ "version": "1.0.7",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",