Skip to content

Instantly share code, notes, and snippets.

@WrathChaos
Created April 14, 2020 18:03
Show Gist options
  • Save WrathChaos/10532cfbd324f733709e7b529d945d00 to your computer and use it in GitHub Desktop.
Save WrathChaos/10532cfbd324f733709e7b529d945d00 to your computer and use it in GitHub Desktop.
React Native Google Maps Navigation?
const createNavigationURL = (startLat, startLng, lat, lng) => {
  const scheme = Platform.select({
    ios: `maps:${startLat}?q=`,
    android: `geo:${startLng}?q=`
  });
  const latLng = `${lat},${lng}`;
  const label = "Custom Label";
  const url = Platform.select({
    ios: `${scheme}${label}@${latLng}`,
    android: `${scheme}${latLng}(${label})`
  });
  return url;
};

export { createNavigationURL };
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment