React Native : open route with multiple stops in native map application (google maps or apple map)

583 Views Asked by At

I can open a route from my location to a location in native map application from my react native code in the following way

const urlScheme = Platform.select({
                    ios: 'maps:0,0?q=${location_label}@${location_latitude},${location_lobgitude}',
                    android: 'geo:0,0?q=${location_latitude},${location_lobgitude},${location_label})',
                  });
linking.open(urlScheme)

but my current requirement is to open a route with multiple stops in respective native map application.

I tried using a custom google map web url shown below,

onPress={() => Linking.openURL("https://www.google.co.in/maps/dir/18.6121132,73.707989/18.5,73.7/18.8,73.71")}

It kind of works but opens with preview and steps options instead of start navigation in emulator. I would prefer if it showed start navigation button and user could start navigation by clicking it. Couldnt find a similar solution for iOS.

0

There are 0 best solutions below