@complexify/expo-mapbox-navigation 1.0.2 → 1.0.4

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.2] - 2025-02-06
3
+ ## [1.0.3] - 2025-02-06
4
4
 
@@ -40,10 +40,20 @@ export type ExpoMapboxNavigationViewProps = {
40
40
  topBannerSecondaryTextColor?: string;
41
41
  topBannerDistanceTextColor?: string;
42
42
  topBannerSeparatorColor?: string;
43
+ informationStackBackgroundColor?: string;
44
+ informationStackTextColor?: string;
43
45
  bottomBannerBackgroundColor?: string;
44
46
  bottomBannerTimeRemainingTextColor?: string;
45
47
  bottomBannerDistanceRemainingTextColor?: string;
46
48
  bottomBannerArrivalTimeTextColor?: string;
49
+ resumeButtonBackgroundColor?: string;
50
+ resumeButtonTextColor?: string;
51
+ speedLimitBackgroundColor?: string;
52
+ speedLimitTextColor?: string;
53
+ floatingStackBackgroundColor?: string;
54
+ floatingButtonsBackgroundColor?: string;
55
+ wayNameViewBackgroundColor?: string;
56
+ wayNameViewTextColor?: string;
47
57
  };
48
58
  export {};
49
59
  //# sourceMappingURL=ExpoMapboxNavigation.types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"ExpoMapboxNavigation.types.d.ts","sourceRoot":"","sources":["../src/ExpoMapboxNavigation.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAE1D,KAAK,aAAa,GAAG;IACnB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;IACzB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,gBAAgB,EAAE,MAAM,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,6BAA6B,GAAG;IAC1C,WAAW,EAAE,KAAK,CAAC;QAAE,QAAQ,EAAE,MAAM,CA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/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 colors\n topBannerBackgroundColor?: string;\n topBannerPrimaryTextColor?: string;\n topBannerSecondaryTextColor?: string;\n topBannerDistanceTextColor?: string;\n topBannerSeparatorColor?: string;\n \n // Bottom banner colors\n bottomBannerBackgroundColor?: string;\n bottomBannerTimeRemainingTextColor?: string;\n bottomBannerDistanceRemainingTextColor?: string;\n bottomBannerArrivalTimeTextColor?: 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"]}
@@ -95,6 +95,113 @@ public class ExpoMapboxNavigationModule: Module {
95
95
  view.controller.setTopBannerPrimaryTextColor(hexColor: hexColor)
96
96
  }
97
97
  }
98
+
99
+ Prop("topBannerSecondaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
100
+ if let hexColor = color {
101
+ view.controller.setTopBannerSecondaryTextColor(hexColor: hexColor)
102
+ }
103
+ }
104
+
105
+ Prop("topBannerDistanceTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
106
+ if let hexColor = color {
107
+ view.controller.setTopBannerDistanceTextColor(hexColor: hexColor)
108
+ }
109
+ }
110
+
111
+ Prop("topBannerSeparatorColor") { (view: ExpoMapboxNavigationView, color: String?) in
112
+ if let hexColor = color {
113
+ view.controller.setTopBannerSeparatorColor(hexColor: hexColor)
114
+ }
115
+ }
116
+
117
+ Prop("bottomBannerBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
118
+ if let hexColor = color {
119
+ view.controller.setBottomBannerBackgroundColor(hexColor: hexColor)
120
+ }
121
+ }
122
+
123
+ Prop("bottomBannerTimeRemainingTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
124
+ if let hexColor = color {
125
+ view.controller.setBottomBannerTimeRemainingTextColor(hexColor: hexColor)
126
+ }
127
+ }
128
+
129
+ Prop("bottomBannerDistanceRemainingTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
130
+ if let hexColor = color {
131
+ view.controller.setBottomBannerDistanceRemainingTextColor(hexColor: hexColor)
132
+ }
133
+ }
134
+
135
+ Prop("bottomBannerArrivalTimeTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
136
+ if let hexColor = color {
137
+ view.controller.setBottomBannerArrivalTimeTextColor(hexColor: hexColor)
138
+ }
139
+ }
140
+
141
+ // Information Stack
142
+ Prop("informationStackBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
143
+ if let hexColor = color {
144
+ view.controller.setInformationStackBackgroundColor(hexColor: hexColor)
145
+ }
146
+ }
147
+
148
+ Prop("informationStackTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
149
+ if let hexColor = color {
150
+ view.controller.setInformationStackTextColor(hexColor: hexColor)
151
+ }
152
+ }
153
+
154
+ // Resume Button
155
+ Prop("resumeButtonBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
156
+ if let hexColor = color {
157
+ view.controller.setResumeButtonBackgroundColor(hexColor: hexColor)
158
+ }
159
+ }
160
+
161
+ Prop("resumeButtonTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
162
+ if let hexColor = color {
163
+ view.controller.setResumeButtonTextColor(hexColor: hexColor)
164
+ }
165
+ }
166
+
167
+ // Speed Limit
168
+ Prop("speedLimitBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
169
+ if let hexColor = color {
170
+ view.controller.setSpeedLimitBackgroundColor(hexColor: hexColor)
171
+ }
172
+ }
173
+
174
+ Prop("speedLimitTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
175
+ if let hexColor = color {
176
+ view.controller.setSpeedLimitTextColor(hexColor: hexColor)
177
+ }
178
+ }
179
+
180
+ // Floating Stack
181
+ Prop("floatingStackBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
182
+ if let hexColor = color {
183
+ view.controller.setFloatingStackBackgroundColor(hexColor: hexColor)
184
+ }
185
+ }
186
+
187
+ Prop("floatingButtonsBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
188
+ if let hexColor = color {
189
+ view.controller.setFloatingButtonsBackgroundColor(hexColor: hexColor)
190
+ }
191
+ }
192
+
193
+ // Way Name View
194
+ Prop("wayNameViewBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
195
+ if let hexColor = color {
196
+ view.controller.setWayNameViewBackgroundColor(hexColor: hexColor)
197
+ }
198
+ }
199
+
200
+ Prop("wayNameViewTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
201
+ if let hexColor = color {
202
+ view.controller.setWayNameViewTextColor(hexColor: hexColor)
203
+ }
204
+ }
98
205
  }
99
206
  }
100
207
  }
@@ -75,6 +75,25 @@ class ExpoMapboxNavigationViewController: UIViewController {
75
75
 
76
76
  var topBannerBackgroundColor: UIColor?
77
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?
78
97
 
79
98
  init() {
80
99
  super.init(nibName: nil, bundle: nil)
@@ -225,6 +244,91 @@ class ExpoMapboxNavigationViewController: UIViewController {
225
244
  update()
226
245
  }
227
246
 
247
+ func setTopBannerSecondaryTextColor(hexColor: String) {
248
+ topBannerSecondaryTextColor = UIColor(hex: hexColor)
249
+ update()
250
+ }
251
+
252
+ func setTopBannerDistanceTextColor(hexColor: String) {
253
+ topBannerDistanceTextColor = UIColor(hex: hexColor)
254
+ update()
255
+ }
256
+
257
+ func setTopBannerSeparatorColor(hexColor: String) {
258
+ topBannerSeparatorColor = UIColor(hex: hexColor)
259
+ update()
260
+ }
261
+
262
+ func setBottomBannerBackgroundColor(hexColor: String) {
263
+ bottomBannerBackgroundColor = UIColor(hex: hexColor)
264
+ update()
265
+ }
266
+
267
+ func setBottomBannerTimeRemainingTextColor(hexColor: String) {
268
+ bottomBannerTimeRemainingTextColor = UIColor(hex: hexColor)
269
+ update()
270
+ }
271
+
272
+ func setBottomBannerDistanceRemainingTextColor(hexColor: String) {
273
+ bottomBannerDistanceRemainingTextColor = UIColor(hex: hexColor)
274
+ update()
275
+ }
276
+
277
+ func setBottomBannerArrivalTimeTextColor(hexColor: String) {
278
+ bottomBannerArrivalTimeTextColor = UIColor(hex: hexColor)
279
+ update()
280
+ }
281
+
282
+ func setInformationStackBackgroundColor(hexColor: String) {
283
+ informationStackBackgroundColor = UIColor(hex: hexColor)
284
+ update()
285
+ }
286
+
287
+ func setInformationStackTextColor(hexColor: String) {
288
+ informationStackTextColor = UIColor(hex: hexColor)
289
+ update()
290
+ }
291
+
292
+ func setResumeButtonBackgroundColor(hexColor: String) {
293
+ resumeButtonBackgroundColor = UIColor(hex: hexColor)
294
+ update()
295
+ }
296
+
297
+ func setResumeButtonTextColor(hexColor: String) {
298
+ resumeButtonTextColor = UIColor(hex: hexColor)
299
+ update()
300
+ }
301
+
302
+ func setSpeedLimitBackgroundColor(hexColor: String) {
303
+ speedLimitBackgroundColor = UIColor(hex: hexColor)
304
+ update()
305
+ }
306
+
307
+ func setSpeedLimitTextColor(hexColor: String) {
308
+ speedLimitTextColor = UIColor(hex: hexColor)
309
+ update()
310
+ }
311
+
312
+ func setFloatingStackBackgroundColor(hexColor: String) {
313
+ floatingStackBackgroundColor = UIColor(hex: hexColor)
314
+ update()
315
+ }
316
+
317
+ func setFloatingButtonsBackgroundColor(hexColor: String) {
318
+ floatingButtonsBackgroundColor = UIColor(hex: hexColor)
319
+ update()
320
+ }
321
+
322
+ func setWayNameViewBackgroundColor(hexColor: String) {
323
+ wayNameViewBackgroundColor = UIColor(hex: hexColor)
324
+ update()
325
+ }
326
+
327
+ func setWayNameViewTextColor(hexColor: String) {
328
+ wayNameViewTextColor = UIColor(hex: hexColor)
329
+ update()
330
+ }
331
+
228
332
  func update(){
229
333
  calculateRoutesTask?.cancel()
230
334
 
@@ -291,54 +395,51 @@ class ExpoMapboxNavigationViewController: UIViewController {
291
395
  func onRoutesCalculated(navigationRoutes: NavigationRoutes){
292
396
  onRoutesLoaded?()
293
397
 
294
- let topBanner = TopBannerViewController()
295
- let bottomBanner = BottomBannerViewController()
296
-
297
- // Customize top banner colors
298
- topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF") // Background color
299
- topBanner.instructionsBannerView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000") // Primary instruction text
300
- topBanner.instructionsBannerView.secondaryLabel.textColor = UIColor(hex: "#666666") // Secondary instruction text
301
- topBanner.instructionsBannerView.distanceLabel.textColor = UIColor(hex: "#666666") // Distance text
302
- topBanner.instructionsBannerView.separatorView.backgroundColor = UIColor(hex: "#EEEEEE") // Separator line
303
-
304
- // Customize bottom banner colors
305
- bottomBanner.backgroundColor = UIColor(hex: "#FFFFFF") // Background color
306
- bottomBanner.timeRemainingLabel.textColor = UIColor(hex: "#000000") // Time remaining text
307
- bottomBanner.distanceRemainingLabel.textColor = UIColor(hex: "#666666") // Distance remaining text
308
- bottomBanner.arrivalTimeLabel.textColor = UIColor(hex: "#666666") // Arrival time text
309
-
310
- // Set locale formatters
311
- topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
312
- bottomBanner.distanceFormatter.locale = currentLocale
313
- bottomBanner.dateFormatter.locale = currentLocale
314
-
315
- let navigationOptions = NavigationOptions(
316
- mapboxNavigation: self.mapboxNavigation!,
317
- voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
318
- eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager(),
319
- topBanner: topBanner,
320
- bottomBanner: bottomBanner
321
- )
322
-
323
398
  let navigationViewController = NavigationViewController(
324
399
  navigationRoutes: navigationRoutes,
325
- navigationOptions: navigationOptions
400
+ navigationOptions: NavigationOptions(
401
+ styles: [.dayStyle],
402
+ navigationMapView: nil,
403
+ voiceController: ExpoMapboxNavigationViewController.navigationProvider.routeVoiceController,
404
+ eventsManager: ExpoMapboxNavigationViewController.navigationProvider.eventsManager()
405
+ )
326
406
  )
327
407
 
328
- let navigationMapView = navigationViewController.navigationMapView
329
- navigationMapView!.puckType = .puck2D(.navigationDefault)
408
+ let navigationView = navigationViewController.navigationView
330
409
 
331
- let style = currentMapStyle != nil ? StyleURI(rawValue: currentMapStyle!) : StyleURI.streets
332
- navigationMapView!.mapView.mapboxMap.loadStyle(style!, completion: { _ in
333
- navigationMapView!.localizeLabels(locale: self.currentLocale)
334
- do{
335
- try navigationMapView!.mapView.mapboxMap.localizeLabels(into: self.currentLocale)
336
- } catch {}
337
- })
338
-
410
+ // Customize top banner colors
411
+ let topBanner = navigationView.topBannerContainerView
412
+ topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
413
+ let instructionsView = navigationView.instructionsBannerView
414
+ instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
415
+ instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
416
+ instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
417
+ instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
418
+
419
+ // Customize bottom banner colors
420
+ let bottomBanner = navigationView.bottomBannerContainerView
421
+ bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
422
+ let bottomView = navigationView.bottomBannerView
423
+ bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
424
+ bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
425
+ bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
426
+
427
+ 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
+ }
339
440
 
340
- let cancelButton = navigationViewController.navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self)[0]
341
- cancelButton.addTarget(self, action: #selector(cancelButtonClicked), for: .touchUpInside)
441
+ let cancelButton = navigationView.bottomBannerContainerView.findViews(subclassOf: CancelButton.self).first
442
+ cancelButton?.addTarget(self, action: #selector(cancelButtonClicked), for: UIControl.Event.touchUpInside)
342
443
 
343
444
  navigationViewController.delegate = self
344
445
  addChild(navigationViewController)
@@ -350,9 +451,9 @@ class ExpoMapboxNavigationViewController: UIViewController {
350
451
  navigationViewController.view.topAnchor.constraint(equalTo: view.topAnchor, constant: 0),
351
452
  navigationViewController.view.bottomAnchor.constraint(equalTo: view.bottomAnchor, constant: 0),
352
453
  ])
353
- didMove(toParent: self)
454
+ navigationViewController.didMove(toParent: self)
354
455
  mapboxNavigation!.tripSession().startActiveGuidance(with: navigationRoutes, startLegIndex: 0)
355
-
456
+
356
457
  // Apply custom colors if set
357
458
  if let routeColor = currentRouteColor {
358
459
  navigationMapView?.routeColor = routeColor
@@ -372,6 +473,41 @@ class ExpoMapboxNavigationViewController: UIViewController {
372
473
  if let arrowColor = currentManeuverArrowColor {
373
474
  navigationMapView?.maneuverArrowColor = arrowColor
374
475
  }
476
+
477
+ // 2. Information Stack
478
+ let infoStack = navigationView.informationStackView
479
+ infoStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
480
+ for view in infoStack.arrangedSubviews {
481
+ if let label = view as? UILabel {
482
+ label.textColor = informationStackTextColor ?? UIColor(hex: "#000000")
483
+ }
484
+ }
485
+
486
+ // 4. Resume Button
487
+ let resumeButton = navigationView.resumeButton
488
+ resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
489
+ resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: UIControl.State.normal)
490
+
491
+ // 5. Speed Limit View
492
+ let speedLimitView = navigationView.speedLimitView
493
+ speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
494
+ if let speedLabel = speedLimitView.subviews.first as? UILabel {
495
+ speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
496
+ }
497
+
498
+ // 6. Floating Stack
499
+ let floatingStack = navigationView.floatingStackView
500
+ floatingStack.backgroundColor = floatingStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
501
+ for button in floatingStack.arrangedSubviews {
502
+ if let floatingButton = button as? UIButton {
503
+ floatingButton.backgroundColor = floatingButtonsBackgroundColor ?? UIColor(hex: "#FFFFFF")
504
+ }
505
+ }
506
+
507
+ // 8. Way Name Label
508
+ let wayNameView = navigationView.wayNameView
509
+ wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
510
+ wayNameView.label.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
375
511
  }
376
512
  }
377
513
  extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.2",
3
+ "version": "1.0.4",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -33,16 +33,36 @@ export type ExpoMapboxNavigationViewProps = {
33
33
  onRoutesLoaded?: () => void;
34
34
  style?: StyleProp<ViewStyle>;
35
35
 
36
- // Top banner colors
36
+ // Top Banner (1)
37
37
  topBannerBackgroundColor?: string;
38
38
  topBannerPrimaryTextColor?: string;
39
39
  topBannerSecondaryTextColor?: string;
40
40
  topBannerDistanceTextColor?: string;
41
41
  topBannerSeparatorColor?: string;
42
-
43
- // Bottom banner colors
42
+
43
+ // Information Stack (2)
44
+ informationStackBackgroundColor?: string;
45
+ informationStackTextColor?: string;
46
+
47
+ // Bottom Banner (3)
44
48
  bottomBannerBackgroundColor?: string;
45
49
  bottomBannerTimeRemainingTextColor?: string;
46
50
  bottomBannerDistanceRemainingTextColor?: string;
47
51
  bottomBannerArrivalTimeTextColor?: string;
52
+
53
+ // Resume Button (4)
54
+ resumeButtonBackgroundColor?: string;
55
+ resumeButtonTextColor?: string;
56
+
57
+ // Speed Limit View (5)
58
+ speedLimitBackgroundColor?: string;
59
+ speedLimitTextColor?: string;
60
+
61
+ // Floating Stack (6)
62
+ floatingStackBackgroundColor?: string;
63
+ floatingButtonsBackgroundColor?: string;
64
+
65
+ // Way Name Label (8)
66
+ wayNameViewBackgroundColor?: string;
67
+ wayNameViewTextColor?: string;
48
68
  };