@complexify/expo-mapbox-navigation 1.0.1 → 1.0.2
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 -16
- package/README.md +2 -2
- package/build/ExpoMapboxNavigation.types.d.ts +9 -0
- package/build/ExpoMapboxNavigation.types.d.ts.map +1 -1
- package/build/ExpoMapboxNavigation.types.js.map +1 -1
- package/ios/ExpoMapboxNavigationModule.swift +12 -0
- package/ios/ExpoMapboxNavigationView.swift +29 -1
- package/package.json +6 -10
- package/src/ExpoMapboxNavigation.types.ts +13 -0
package/CHANGELOG.md
CHANGED
@@ -1,19 +1,4 @@
|
|
1
1
|
# Changelog
|
2
2
|
|
3
|
-
## [1.0.
|
3
|
+
## [1.0.2] - 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 @
|
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
|
-
"@
|
30
|
+
"@complexify/expo-mapbox-navigation",
|
31
31
|
{
|
32
32
|
"accessToken": "<YOUR_TOKEN>",
|
33
33
|
"mapboxMapsVersion": "<MAPBOX_MAPS_VERSION>"
|
@@ -35,6 +35,15 @@ 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
|
+
bottomBannerBackgroundColor?: string;
|
44
|
+
bottomBannerTimeRemainingTextColor?: string;
|
45
|
+
bottomBannerDistanceRemainingTextColor?: string;
|
46
|
+
bottomBannerArrivalTimeTextColor?: string;
|
38
47
|
};
|
39
48
|
export {};
|
40
49
|
//# 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,YA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AC,EAAE,MAAM,CAAC;IACpC,uBAAuB,CAAC,EAAE,MAAM,CAAC;IAGjC,2BAA2B,CAAC,EAAE,MAAM,CAAC;IACrC,kCAAkC,CAAC,EAAE,MAAM,CAAC;IAC5C,sCAAsC,CAAC,EAAE,MAAM,CAAC;IAChD,gCAAgC,CAAC,EAAE,MAAM,CAAC;CAC3C,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 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"]}
|
@@ -83,6 +83,18 @@ 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
|
+
}
|
86
98
|
}
|
87
99
|
}
|
88
100
|
}
|
@@ -73,6 +73,9 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
73
73
|
var currentTraversedRouteColor: UIColor?
|
74
74
|
var currentManeuverArrowColor: UIColor?
|
75
75
|
|
76
|
+
var topBannerBackgroundColor: UIColor?
|
77
|
+
var topBannerPrimaryTextColor: UIColor?
|
78
|
+
|
76
79
|
init() {
|
77
80
|
super.init(nibName: nil, bundle: nil)
|
78
81
|
mapboxNavigation = ExpoMapboxNavigationViewController.navigationProvider.mapboxNavigation
|
@@ -212,6 +215,16 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
212
215
|
update()
|
213
216
|
}
|
214
217
|
|
218
|
+
func setTopBannerBackgroundColor(hexColor: String) {
|
219
|
+
topBannerBackgroundColor = UIColor(hex: hexColor)
|
220
|
+
update()
|
221
|
+
}
|
222
|
+
|
223
|
+
func setTopBannerPrimaryTextColor(hexColor: String) {
|
224
|
+
topBannerPrimaryTextColor = UIColor(hex: hexColor)
|
225
|
+
update()
|
226
|
+
}
|
227
|
+
|
215
228
|
func update(){
|
216
229
|
calculateRoutesTask?.cancel()
|
217
230
|
|
@@ -279,8 +292,23 @@ class ExpoMapboxNavigationViewController: UIViewController {
|
|
279
292
|
onRoutesLoaded?()
|
280
293
|
|
281
294
|
let topBanner = TopBannerViewController()
|
282
|
-
topBanner.instructionsBannerView.distanceFormatter.locale = currentLocale
|
283
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
|
284
312
|
bottomBanner.distanceFormatter.locale = currentLocale
|
285
313
|
bottomBanner.dateFormatter.locale = currentLocale
|
286
314
|
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@complexify/expo-mapbox-navigation",
|
3
|
-
"version": "1.0.
|
3
|
+
"version": "1.0.2",
|
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
|
-
"
|
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,17 @@ export type ExpoMapboxNavigationViewProps = {
|
|
32
32
|
onUserOffRoute?: () => void;
|
33
33
|
onRoutesLoaded?: () => void;
|
34
34
|
style?: StyleProp<ViewStyle>;
|
35
|
+
|
36
|
+
// Top banner colors
|
37
|
+
topBannerBackgroundColor?: string;
|
38
|
+
topBannerPrimaryTextColor?: string;
|
39
|
+
topBannerSecondaryTextColor?: string;
|
40
|
+
topBannerDistanceTextColor?: string;
|
41
|
+
topBannerSeparatorColor?: string;
|
42
|
+
|
43
|
+
// Bottom banner colors
|
44
|
+
bottomBannerBackgroundColor?: string;
|
45
|
+
bottomBannerTimeRemainingTextColor?: string;
|
46
|
+
bottomBannerDistanceRemainingTextColor?: string;
|
47
|
+
bottomBannerArrivalTimeTextColor?: string;
|
35
48
|
};
|