@complexify/expo-mapbox-navigation 1.0.3 → 1.0.5

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/CHANGELOG.md CHANGED
@@ -1,4 +1,4 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.3] - 2025-02-06
3
+ ## [1.0.5] - 2025-02-07
4
4
 
@@ -392,40 +392,50 @@ class ExpoMapboxNavigationViewController: UIViewController {
392
392
  onCancelNavigation?()
393
393
  }
394
394
 
395
- func onRoutesCalculated(navigationRoutes: NavigationRoutes){
395
+ func onRoutesCalculated(navigationRoutes: NavigationRoutes) {
396
396
  onRoutesLoaded?()
397
397
 
398
+ let topBanner = TopBannerViewController()
399
+ topBanner.view.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
400
+ topBanner.instructionsBannerView.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
401
+ topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
402
+
403
+ let bottomBanner = BottomBannerViewController()
404
+ bottomBanner.view.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
405
+ bottomBanner.distanceFormatter.locale = currentLocale
406
+ bottomBanner.dateFormatter.locale = currentLocale
407
+
408
+ let navigationOptions = NavigationOptions(
409
+ mapboxNavigation: self.mapboxNavigation!,
410
+ voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
411
+ eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
412
+ styles: nil,
413
+ topBanner: topBanner,
414
+ bottomBanner: bottomBanner,
415
+ predictiveCacheManager: nil,
416
+ navigationMapView: nil
417
+ )
418
+
398
419
  let navigationViewController = NavigationViewController(
399
420
  navigationRoutes: navigationRoutes,
400
421
  navigationOptions: navigationOptions
401
422
  )
402
423
 
403
- // Customize top banner colors
404
- let topBanner = navigationViewController.navigationView.topBannerContainerView
405
- topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
406
- let instructionsView = navigationViewController.navigationView.instructionsBannerView
424
+ let navigationView = navigationViewController.navigationView
425
+
426
+ // Then customize the properly initialized banners
427
+ let instructionsView = navigationView.instructionsBannerView
407
428
  instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
408
429
  instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
409
430
  instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
410
431
  instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
411
432
 
412
- // Customize bottom banner colors
413
- let bottomBanner = navigationViewController.navigationView.bottomBannerContainerView
414
- bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
415
- let bottomView = navigationViewController.navigationView.bottomBannerView
433
+ let bottomView = navigationView.bottomBannerView
416
434
  bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
417
435
  bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
418
436
  bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
419
437
 
420
- let navigationOptions = NavigationOptions(
421
- mapboxNavigation: self.mapboxNavigation!,
422
- voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
423
- eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
424
- topBanner: topBanner,
425
- bottomBanner: bottomBanner
426
- )
427
-
428
- let navigationMapView = navigationViewController.navigationMapView
438
+ let navigationMapView = navigationView.navigationMapView
429
439
  navigationMapView!.puckType = .puck2D(.navigationDefault)
430
440
 
431
441
  let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
@@ -435,10 +445,9 @@ class ExpoMapboxNavigationViewController: UIViewController {
435
445
  try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
436
446
  } catch {}
437
447
  })
438
-
439
448
 
440
- let cancelButton = navigationViewController.navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self)[0]
441
- cancelButton.addTarget(self, action: #selector(cancelButtonClicked), for: .touchUpInside)
449
+ let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
450
+ cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
442
451
 
443
452
  navigationViewController.delegate = self
444
453
  addChild(navigationViewController)
@@ -450,9 +459,9 @@ class ExpoMapboxNavigationViewController: UIViewController {
450
459
  navigationViewController.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0),
451
460
  navigationViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
452
461
  ])
453
- didMove(toParent: self)
462
+ navigationViewController.didMove(toParent: self)
454
463
  mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
455
-
464
+
456
465
  // Apply custom colors if set
457
466
  if let routeColor = currentRouteColor {
458
467
  navigationMapView?.routeColor = routeColor
@@ -474,7 +483,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
474
483
  }
475
484
 
476
485
  // 2. Information Stack
477
- let infoStack = navigationViewController.navigationView.informationStackView
486
+ let infoStack = navigationView.informationStackView
478
487
  infoStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
479
488
  for view in infoStack.arrangedSubviews {
480
489
  if let label = view as? UILabel {
@@ -483,19 +492,19 @@ class ExpoMapboxNavigationViewController: UIViewController {
483
492
  }
484
493
 
485
494
  // 4. Resume Button
486
- let resumeButton = navigationViewController.navigationView.resumeButton
495
+ let resumeButton = navigationView.resumeButton
487
496
  resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
488
- resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: .normal)
497
+ resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: UIControl.State.normal)
489
498
 
490
499
  // 5. Speed Limit View
491
- let speedLimitView = navigationViewController.navigationView.speedLimitView
500
+ let speedLimitView = navigationView.speedLimitView
492
501
  speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
493
502
  if let speedLabel = speedLimitView.subviews.first as? UILabel {
494
503
  speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
495
504
  }
496
505
 
497
506
  // 6. Floating Stack
498
- let floatingStack = navigationViewController.navigationView.floatingStackView
507
+ let floatingStack = navigationView.floatingStackView
499
508
  floatingStack.backgroundColor = floatingStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
500
509
  for button in floatingStack.arrangedSubviews {
501
510
  if let floatingButton = button as? UIButton {
@@ -504,7 +513,7 @@ class ExpoMapboxNavigationViewController: UIViewController {
504
513
  }
505
514
 
506
515
  // 8. Way Name Label
507
- let wayNameView = navigationViewController.navigationView.wayNameView
516
+ let wayNameView = navigationView.wayNameView
508
517
  wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
509
518
  wayNameView.label.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
510
519
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",