我正在使用React Native,并尝试理解一些示例。
我有问题
我正在尝试通过纬度进行传递,但是我遇到一个问题,谁说我的“纬度”不存在
class App extends React.Component {
constructor() {
super();
this.state = {
region: {
latitude: LATITUDE,longitude: LONGITUDE,latitudeDelta: LATITUDE_DELTA,longitudeDelta: LONGITUDE_DELTA,},markers: [],loaded: false
}
}
componentDidmount() {
navigator.geolocation.getcurrentPosition(
(position) => {
console.log(position);
this.setState({
region: {
latitude: position.coords.latitude,longitude: position.coords.longitude,}
});
},(error) => this.setState({ error: error.message }),{ enableHighaccuracy: false,timeout: 200000,maximumAge: 1000 },);
this.getLocations()
}
getLocations(){
return fetch('https://***&geofilter.distance='+latitude+'%2C2.3883402698750875%2C2000') //here
.then(response => response.json())
.then(responseData =>{
var markers = [];
您能帮我吗,谢谢:)