在许多iOS应用程序中,我可以看到一个按钮,说明getDirections,点击后会打开经过目的地的纬度和经度的Apple/Google地图.
我的TouchableHighlight按钮有lat和lng准备好了.我需要在onPress回调中调用什么API端点来打开Apple坐标作为路径目的地的坐标?
Col*_*say 15
要链接到其他应用程序(例如地图),请使用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);
Run Code Online (Sandbox Code Playgroud)
对于地图,URL方案与标准Obj-C应用程序相同:
要链接到其他应用程序,并将行程打开为地图,请使用此功能:
export function openDirections(latitude, longitude) {
Platform.select({
ios: () => {
Linking.openURL('http://maps.apple.com/maps?daddr=' + latitude + ',' + longitude);
},
android: () => {
Linking.openURL('http://maps.google.com/maps?daddr=' + latitude + ',' + longitude);
}
})();
}
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6628 次 |
| 最近记录: |