@complexify/expo-mapbox-navigation 1.0.4 → 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,51 +392,59 @@ 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
- navigationOptions: NavigationOptions(
401
- styles: [.dayStyle],
402
- navigationMapView: nil,
403
- voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
404
- eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager()
405
- )
421
+ navigationOptions: navigationOptions
406
422
  )
407
423
 
408
424
  let navigationView = navigationViewController.navigationView
409
-
410
- // Customize top banner colors
411
- let topBanner = navigationView.topBannerContainerView
412
- topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
425
+
426
+ // Then customize the properly initialized banners
413
427
  let instructionsView = navigationView.instructionsBannerView
414
428
  instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
415
429
  instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
416
430
  instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
417
431
  instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
418
432
 
419
- // Customize bottom banner colors
420
- let bottomBanner = navigationView.bottomBannerContainerView
421
- bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
422
433
  let bottomView = navigationView.bottomBannerView
423
434
  bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
424
435
  bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
425
436
  bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
426
437
 
427
438
  let navigationMapView = navigationView.navigationMapView
428
- navigationMapView?.puckConfiguration = .puck2D()
429
-
430
- if let style = currentMapStyle {
431
- navigationMapView?.mapView.mapboxMap.loadStyle(StyleURI(rawValue: style)) { _ in
432
- navigationMapView?.localizeLabels(locale: self.currentLocale)
433
- do {
434
- try navigationMapView?.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
435
- } catch {
436
- print("Failed to localize map labels: \(error)")
437
- }
438
- }
439
- }
439
+ navigationMapView!.puckType = .puck2D(.navigationDefault)
440
+
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
+ })
440
448
 
441
449
  let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
442
450
  cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.4",
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",