Open ken92 opened 6 years ago
I tested this in my own code and it solves my use case's problem. I can now view truck routes in my map! :)
@iniamudhan Any chance I can get an approval on this? My code needs to go into QA soon and I don't really want to make my own spin-off of your repo just for this one line fix.
My code needs to go into QA today, it turns out. In the meantime, I've created this package with this fix in it. Currently, there are no other differences.
How are you able to get truck routes to show? I can do driving and transit, but when I change routeMode to truck I get an error:
"errorDetails": [ "One or more parameters are not valid.", "waypoint: Parameter is missing" ]
I've been messing with the Bing Maps API with Postman and comparing what react-bingmaps is sending and it appears that for whatever reason, when
routeMode
is set totruck
, Bing Maps will return an error ifisViaPoint
is set tonull.
I've tried to set it totrue
,1
,0
,"1"
,"0"
,"true"
, "false"`, but any falsy value is being automatically set to null in the code.An easy fix would be to replace this:
var isViaPoint = wayPoints[wayPointsIndex].isViaPoint ? wayPoints[wayPointsIndex].isViaPoint : null;
with this:
var isViaPoint = wayPoints[wayPointsIndex].isViaPoint !== undefined ? wayPoints[wayPointsIndex].isViaPoint : null;
That way, users can pass falsy values and it will be passed on to the Bing Maps API as they intend.
Alternatively, if anyone knows how to get this to work without modifying the repo, I'm all ears.