diff --git a/index.d.ts b/index.d.ts index b19991a..c960688 100644 --- a/index.d.ts +++ b/index.d.ts @@ -116,6 +116,10 @@ declare module "react-native-maps-directions" { * Array of waypoints to use between origin and destination. */ waypoints?: MapViewDirectionsWaypoints[]; + /** + * Avoid type of ways + */ + avoid: string; /** * The destination location to start routing to. */ diff --git a/package.json b/package.json index 6df1de5..8cf868b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "react-native-maps-directions", - "version": "1.9.0", + "version": "1.9.1", "description": "Directions Component for react-native-maps", "main": "index.js", "scripts": { diff --git a/src/MapViewDirections.js b/src/MapViewDirections.js index 8e05906..5ce29b8 100644 --- a/src/MapViewDirections.js +++ b/src/MapViewDirections.js @@ -86,6 +86,7 @@ class MapViewDirections extends Component { mode = 'DRIVING', language = 'en', optimizeWaypoints, + avoid, splitWaypoints, directionsServiceBaseUrl = 'https://maps.googleapis.com/maps/api/directions/json', region, @@ -174,7 +175,7 @@ class MapViewDirections extends Component { } return ( - this.fetchRoute(directionsServiceBaseUrl, origin, waypoints, destination, apikey, mode, language, region, precision, timePrecisionString, channel) + this.fetchRoute(directionsServiceBaseUrl, origin, waypoints, avoid, destination, apikey, mode, language, region, precision, timePrecisionString, channel) .then(result => { return result; }) @@ -227,12 +228,12 @@ class MapViewDirections extends Component { }); } - fetchRoute(directionsServiceBaseUrl, origin, waypoints, destination, apikey, mode, language, region, precision, timePrecision, channel) { + fetchRoute(directionsServiceBaseUrl, origin, waypoints, avoid, destination, apikey, mode, language, region, precision, timePrecision, channel) { // Define the URL to call. Only add default parameters to the URL if it's a string. let url = directionsServiceBaseUrl; if (typeof (directionsServiceBaseUrl) === 'string') { - url += `?origin=${origin}&waypoints=${waypoints}&destination=${destination}&key=${apikey}&mode=${mode.toLowerCase()}&language=${language}®ion=${region}`; + url += `?origin=${origin}&waypoints=${waypoints}&destination=${destination}&key=${apikey}&mode=${mode.toLowerCase()}&language=${language}®ion=${region}&avoid=${avoid}`; if(timePrecision){ url+=`&departure_time=${timePrecision}`; }