@complexify/expo-mapbox-navigation 1.0.2 → 1.0.3
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 +1 -1
- package/build/ExpoMapboxNavigation.types.d.ts +10 -0
- package/build/ExpoMapboxNavigation.types.d.ts.map +1 -1
- package/build/ExpoMapboxNavigation.types.js.map +1 -1
- package/ios/ExpoMapboxNavigationModule.swift +107 -0
- package/ios/ExpoMapboxNavigationView.swift +157 -22
- package/package.json +1 -1
- package/src/ExpoMapboxNavigation.types.ts +23 -3
package/CHANGELOG.md
CHANGED
@@ -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,a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G7B,4BAA4B,CAAC,EAAE,MAAM,CAAC;IACtC,8BAA8B,CAAC,EAAE,MAAM,CAAC;IAGxC,0BAA0B,CAAC,EAAE,MAAM,CAAC;IACpC,oBAAoB,CAAC,EAAE,MAAM,CAAC;CAC/B,CAAC"}
|
@@ -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
|
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,26 +395,27 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
291
395
|
func onRoutesCalculated(navigationRoutes: NavigationRoutes){
|
292
396
|
onRoutesLoaded?()
|
293
397
|
|
294
|
-
let
|
295
|
-
|
296
|
-
|
398
|
+
let navigationViewController = NavigationViewController(
|
399
|
+
navigationRoutes: navigationRoutes,
|
400
|
+
navigationOptions: navigationOptions
|
401
|
+
)
|
402
|
+
|
297
403
|
// Customize top banner colors
|
298
|
-
topBanner
|
299
|
-
topBanner.
|
300
|
-
|
301
|
-
|
302
|
-
|
404
|
+
let topBanner = navigationViewController.navigationView.topBannerContainerView
|
405
|
+
topBanner.backgroundColor = topBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
406
|
+
let instructionsView = navigationViewController.navigationView.instructionsBannerView
|
407
|
+
instructionsView.primaryLabel.textColor = topBannerPrimaryTextColor ?? UIColor(hex: "#000000")
|
408
|
+
instructionsView.secondaryLabel.textColor = topBannerSecondaryTextColor ?? UIColor(hex: "#666666")
|
409
|
+
instructionsView.distanceLabel.textColor = topBannerDistanceTextColor ?? UIColor(hex: "#666666")
|
410
|
+
instructionsView.separatorView.backgroundColor = topBannerSeparatorColor ?? UIColor(hex: "#EEEEEE")
|
303
411
|
|
304
412
|
// Customize bottom banner colors
|
305
|
-
bottomBanner
|
306
|
-
bottomBanner.
|
307
|
-
|
308
|
-
|
309
|
-
|
310
|
-
|
311
|
-
topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
|
312
|
-
bottomBanner.distanceFormatter.locale = currentLocale
|
313
|
-
bottomBanner.dateFormatter.locale = currentLocale
|
413
|
+
let bottomBanner = navigationViewController.navigationView.bottomBannerContainerView
|
414
|
+
bottomBanner.backgroundColor = bottomBannerBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
415
|
+
let bottomView = navigationViewController.navigationView.bottomBannerView
|
416
|
+
bottomView.timeRemainingLabel.textColor = bottomBannerTimeRemainingTextColor ?? UIColor(hex: "#000000")
|
417
|
+
bottomView.distanceRemainingLabel.textColor = bottomBannerDistanceRemainingTextColor ?? UIColor(hex: "#666666")
|
418
|
+
bottomView.arrivalTimeLabel.textColor = bottomBannerArrivalTimeTextColor ?? UIColor(hex: "#666666")
|
314
419
|
|
315
420
|
let navigationOptions = NavigationOptions(
|
316
421
|
mapboxNavigation: self.mapboxNavigation!,
|
@@ -320,11 +425,6 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
320
425
|
bottomBanner: bottomBanner
|
321
426
|
)
|
322
427
|
|
323
|
-
let navigationViewController = NavigationViewController(
|
324
|
-
navigationRoutes: navigationRoutes,
|
325
|
-
navigationOptions: navigationOptions
|
326
|
-
)
|
327
|
-
|
328
428
|
let navigationMapView = navigationViewController.navigationMapView
|
329
429
|
navigationMapView!.puckType = .puck2D(.navigationDefault)
|
330
430
|
|
@@ -372,6 +472,41 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
372
472
|
if let arrowColor = currentManeuverArrowColor {
|
373
473
|
navigationMapView?.maneuverArrowColor = arrowColor
|
374
474
|
}
|
475
|
+
|
476
|
+
// 2. Information Stack
|
477
|
+
let infoStack = navigationViewController.navigationView.informationStackView
|
478
|
+
infoStack.backgroundColor = informationStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
479
|
+
for view in infoStack.arrangedSubviews {
|
480
|
+
if let label = view as? UILabel {
|
481
|
+
label.textColor = informationStackTextColor ?? UIColor(hex: "#000000")
|
482
|
+
}
|
483
|
+
}
|
484
|
+
|
485
|
+
// 4. Resume Button
|
486
|
+
let resumeButton = navigationViewController.navigationView.resumeButton
|
487
|
+
resumeButton.backgroundColor = resumeButtonBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
488
|
+
resumeButton.setTitleColor(resumeButtonTextColor ?? UIColor(hex: "#000000"), for: .normal)
|
489
|
+
|
490
|
+
// 5. Speed Limit View
|
491
|
+
let speedLimitView = navigationViewController.navigationView.speedLimitView
|
492
|
+
speedLimitView.backgroundColor = speedLimitBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
493
|
+
if let speedLabel = speedLimitView.subviews.first as? UILabel {
|
494
|
+
speedLabel.textColor = speedLimitTextColor ?? UIColor(hex: "#000000")
|
495
|
+
}
|
496
|
+
|
497
|
+
// 6. Floating Stack
|
498
|
+
let floatingStack = navigationViewController.navigationView.floatingStackView
|
499
|
+
floatingStack.backgroundColor = floatingStackBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
500
|
+
for button in floatingStack.arrangedSubviews {
|
501
|
+
if let floatingButton = button as? UIButton {
|
502
|
+
floatingButton.backgroundColor = floatingButtonsBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
503
|
+
}
|
504
|
+
}
|
505
|
+
|
506
|
+
// 8. Way Name Label
|
507
|
+
let wayNameView = navigationViewController.navigationView.wayNameView
|
508
|
+
wayNameView.backgroundColor = wayNameViewBackgroundColor ?? UIColor(hex: "#FFFFFF")
|
509
|
+
wayNameView.label.textColor = wayNameViewTextColor ?? UIColor(hex: "#000000")
|
375
510
|
}
|
376
511
|
}
|
377
512
|
extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
|
package/package.json
CHANGED
@@ -33,16 +33,36 @@ export type ExpoMapboxNavigationViewProps = {
|
|
33
33
|
onRoutesLoaded?: () => void;
|
34
34
|
style?: StyleProp<ViewStyle>;
|
35
35
|
|
36
|
-
// Top
|
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
|
-
//
|
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
|
};
|