首页 > 解决方案 > 如何在Javascript中将纬度和经度作为全局变量访问

问题描述

我在 react-native 中使用地理定位 API。如何从承诺中获取纬度和经度值?

import Geolocation from '@react-native-community/geolocation';

Geolocation.getCurrentPosition((info) => console.log(info));

var latitude, longitude

谢谢,拉贾K

标签: htmlreact-nativewebgeolocation

解决方案


推荐阅读