Feature Request: Add prop for navigation mode
nice-ctrl opened this issue · 2 comments
As said in title, a prop for selecting whether the navigation should be in walking, cycling, or driving mode would be greatly appreciated.
@nice-ctrl yes this is weird, because they even mention it in the README file:
Did you find a solution for this? I really need it in 'walking' mode.
@nice-ctrl, @mariovillamizar - For iOS(not looked at the android side of it yet but should be straightforward) - I would recommend you fork this repo and make some modifications to MapboxNavigationView.swift and MapboxNavigationManager.m.
I have been able to do this with a local clone for testing.
Add a property (i named mine "mode")
MapboxNavigationManager.m
RCT_EXPORT_VIEW_PROPERTY(mode, NSString)
Add the new mode variable and some logic in the embed function to handle the mode property and update the Mapbox ProfileIdentifier accordingly.
MapboxNavigationView.swift
....
@objc var mode: String = "car"
....
private func embed() {
....
var profileIdentifier:ProfileIdentifier = .automobileAvoidingTraffic
if mode == "walk" {
profileIdentifier = .walking
}
if mode == "cycle" {
profileIdentifier = .cycling
}
// let options = NavigationRouteOptions(waypoints: [originWaypoint, destinationWaypoint])
let options = NavigationRouteOptions(waypoints: [originWaypoint, destinationWaypoint], profileIdentifier: profileIdentifier)
.....
}