@complexify/expo-mapbox-navigation 1.0.1 → 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 CHANGED
@@ -1,19 +1,4 @@
1
1
  # Changelog
2
2
 
3
- ## [1.0.0] - 2025-02-06
3
+ ## [1.0.3] - 2025-02-06
4
4
 
5
- ### 🛠 Breaking changes
6
-
7
- ### 🎉 New features
8
- - Added support for route color customization
9
-
10
- - `routeColor`: Customize main route color
11
- - `routeAlternateColor`: Customize alternate routes color
12
- - `routeCasingColor`: Customize main route casing color
13
- - `routeAlternateCasingColor`: Customize alternate routes casing color
14
- - `traversedRouteColor`: Customize traversed route color
15
- - `maneuverArrowColor`: Customize maneuver arrow color
16
-
17
- ### 🐛 Bug fixes
18
-
19
- ### 💡 Others
package/README.md CHANGED
@@ -16,7 +16,7 @@ This package relies on the installtion of `@rnmapbox/maps`, so you'll have to in
16
16
  Run this command to add the package
17
17
 
18
18
  ```
19
- npx expo install @youssefhenna/expo-mapbox-navigation
19
+ npx expo install @complexify/expo-mapbox-navigation
20
20
  ```
21
21
 
22
22
  ### Configure package
@@ -27,7 +27,7 @@ In your `app.json` or `app.js`, you'll need to add a plugin for the package unde
27
27
  "plugins": [
28
28
  ...other plugins
29
29
  [
30
- "@youssefhenna/expo-mapbox-navigation",
30
+ "@complexify/expo-mapbox-navigation",
31
31
  {
32
32
  "accessToken": "<YOUR_TOKEN>",
33
33
  "mapboxMapsVersion": "<MAPBOX_MAPS_VERSION>"
@@ -35,6 +35,25 @@ export type ExpoMapboxNavigationViewProps = {
35
35
  onUserOffRoute?: () => void;
36
36
  onRoutesLoaded?: () => void;
37
37
  style?: StyleProp<ViewStyle>;
38
+ topBannerBackgroundColor?: string;
39
+ topBannerPrimaryTextColor?: string;
40
+ topBannerSecondaryTextColor?: string;
41
+ topBannerDistanceTextColor?: string;
42
+ topBannerSeparatorColor?: string;
43
+ informationStackBackgroundColor?: string;
44
+ informationStackTextColor?: string;
45
+ bottomBannerBackgroundColor?: string;
46
+ bottomBannerTimeRemainingTextColor?: string;
47
+ bottomBannerDistanceRemainingTextColor?: string;
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;
38
57
  };
39
58
  export {};
40
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,CAAC;QAAC,SAAS,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAC5D,eAAe,CAAC,EAAE,MAAM,EAAE,CAAC;IAC3B,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,mBAAmB,CAAC,EAAE,MAAM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,MAAM,CAAC;IAC5C,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAChD,gCAAgC,CAAC,EAAE,MAAM,CAAC;IAG1C,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAG/B,yBAAyB,CAAC,EAAE,MAAM,CAAC;IACnC,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAG7B,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"]}
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"]}
@@ -83,6 +83,125 @@ public class ExpoMapboxNavigationModule: Module {
83
83
  view.controller.setManeuverArrowColor(hexColor: hexColor)
84
84
  }
85
85
  }
86
+
87
+ Prop("topBannerBackgroundColor") { (view: ExpoMapboxNavigationView, color: String?) in
88
+ if let hexColor = color {
89
+ view.controller.setTopBannerBackgroundColor(hexColor: hexColor)
90
+ }
91
+ }
92
+
93
+ Prop("topBannerPrimaryTextColor") { (view: ExpoMapboxNavigationView, color: String?) in
94
+ if let hexColor = color {
95
+ view.controller.setTopBannerPrimaryTextColor(hexColor: hexColor)
96
+ }
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
+ }
86
205
  }
87
206
  }
88
207
  }
@@ -73,6 +73,28 @@ class ExpoMapboxNavigationViewController: UIViewController {
73
73
  var currentTraversedRouteColor: UIColor?
74
74
  var currentManeuverArrowColor: UIColor?
75
75
 
76
+ var topBannerBackgroundColor: UIColor?
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?
97
+
76
98
  init() {
77
99
  super.init(nibName: nil, bundle: nil)
78
100
  mapboxNavigation = ExpoMapboxNavigationViewController.navigationProvider.mapboxNavigation
@@ -212,6 +234,101 @@ class ExpoMapboxNavigationViewController: UIViewController {
212
234
  update()
213
235
  }
214
236
 
237
+ func setTopBannerBackgroundColor(hexColor: String) {
238
+ topBannerBackgroundColor = UIColor(hex: hexColor)
239
+ update()
240
+ }
241
+
242
+ func setTopBannerPrimaryTextColor(hexColor: String) {
243
+ topBannerPrimaryTextColor = UIColor(hex: hexColor)
244
+ update()
245
+ }
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
+
215
332
  func update(){
216
333
  calculateRoutesTask?.cancel()
217
334
 
@@ -278,11 +395,27 @@ class ExpoMapboxNavigationViewController: UIViewController {
278
395
  func onRoutesCalculated(navigationRoutes: NavigationRoutes){
279
396
  onRoutesLoaded?()
280
397
 
281
- let topBanner = TopBannerViewController()
282
- topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
283
- let bottomBanner = BottomBannerViewController()
284
- bottomBanner.distanceFormatter.locale = currentLocale
285
- bottomBanner.dateFormatter.locale = currentLocale
398
+ let navigationViewController = NavigationViewController(
399
+ navigationRoutes: navigationRoutes,
400
+ navigationOptions: navigationOptions
401
+ )
402
+
403
+ // Customize top banner colors
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")
411
+
412
+ // Customize bottom banner colors
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")
286
419
 
287
420
  let navigationOptions = NavigationOptions(
288
421
  mapboxNavigation: self.mapboxNavigation!,
@@ -292,11 +425,6 @@ class ExpoMapboxNavigationViewController: UIViewController {
292
425
  bottomBanner: bottomBanner
293
426
  )
294
427
 
295
- let navigationViewController = NavigationViewController(
296
- navigationRoutes: navigationRoutes,
297
- navigationOptions: navigationOptions
298
- )
299
-
300
428
  let navigationMapView = navigationViewController.navigationMapView
301
429
  navigationMapView!.puckType = .puck2D(.navigationDefault)
302
430
 
@@ -344,6 +472,41 @@ class ExpoMapboxNavigationViewController: UIViewController {
344
472
  if let arrowColor = currentManeuverArrowColor {
345
473
  navigationMapView?.maneuverArrowColor = arrowColor
346
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")
347
510
  }
348
511
  }
349
512
  extension ExpoMapboxNavigationViewController: NavigationViewControllerDelegate {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@complexify/expo-mapbox-navigation",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "Expo module for Mapbox's Navigation SDK",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -23,28 +23,24 @@
23
23
  "@complexify/expo-mapbox-navigation",
24
24
  "ExpoMapboxNavigation"
25
25
  ],
26
- "repository": {
27
- "type": "git",
28
- "url": "git+https://github.com/complexify/expo-mapbox-navigation.git"
29
- },
26
+ "repository": "https://github.com/complexify/expo-mapbox-navigation",
30
27
  "bugs": {
31
28
  "url": "https://github.com/complexify/expo-mapbox-navigation/issues"
32
29
  },
33
30
  "author": "complexify",
34
31
  "license": "MIT",
35
32
  "homepage": "https://github.com/complexify/expo-mapbox-navigation#readme",
33
+ "dependencies": {},
36
34
  "devDependencies": {
37
- "@expo/config-plugins": "~8.0.10",
38
35
  "@types/react": "^18.0.25",
39
- "@types/react-native": "^0.72.8",
40
36
  "expo-module-scripts": "^3.5.2",
41
37
  "expo-modules-core": "~1.11.14",
42
- "react-native": "^0.77.0"
38
+ "@expo/config-plugins": "~8.0.10"
43
39
  },
44
40
  "peerDependencies": {
45
- "@rnmapbox/maps": "*",
46
41
  "expo": "*",
47
42
  "react": "*",
48
- "react-native": "*"
43
+ "react-native": "*",
44
+ "@rnmapbox/maps": "*"
49
45
  }
50
46
  }
@@ -32,4 +32,37 @@ export type ExpoMapboxNavigationViewProps = {
32
32
  onUserOffRoute?: () => void;
33
33
  onRoutesLoaded?: () => void;
34
34
  style?: StyleProp<ViewStyle>;
35
+
36
+ // Top Banner (1)
37
+ topBannerBackgroundColor?: string;
38
+ topBannerPrimaryTextColor?: string;
39
+ topBannerSecondaryTextColor?: string;
40
+ topBannerDistanceTextColor?: string;
41
+ topBannerSeparatorColor?: string;
42
+
43
+ // Information Stack (2)
44
+ informationStackBackgroundColor?: string;
45
+ informationStackTextColor?: string;
46
+
47
+ // Bottom Banner (3)
48
+ bottomBannerBackgroundColor?: string;
49
+ bottomBannerTimeRemainingTextColor?: string;
50
+ bottomBannerDistanceRemainingTextColor?: string;
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;
35
68
  };