在许多 iOS 应用程序中,我可以看到一个按钮,上面写着 getDirections,点击后会打开一个 Apple/Google map ,其中纬度和经度作为目的地传递。
我有我的 TouchableHighlight
lat 和 lng 按钮准备就绪。我需要在 onPress
中调用什么 API 端点回调以我的坐标作为路线目的地打开 Apple map ?
最佳答案
要链接到另一个应用程序,例如 map ,请使用 LinkingIOS :
https://facebook.github.io/react-native/docs/linkingios.html
// Replace lat and long with your own decimal latitude and longitude values
var url = 'http://maps.apple.com/?ll=<lat>,<long>';
LinkingIOS.openURL(url);
对于 map ,URL 方案与标准 Obj-C 应用程序中的相同:
https://developer.apple.com/library/ios/featuredarticles/iPhoneURLScheme_Reference/MapLinks/MapLinks.html
关于react-native - 获取路线 API 调用? react 原生,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31535582/