-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
34 lines (29 loc) · 800 Bytes
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
import React from 'react';
import {Alert} from "react-native";
import Loading from "./Loading";
import * as Location from 'expo-location';
export default class extends React.Component {
state = {
isLoading: true
};
getLocation = async() => {
try {
await Location.requestPermissionsAsync();
const {
coords: { latitude, longitude }
} = await Location.getCurrentPositionAsync();
// console.log(coords.latitude, coords.longitude);
this.setState({ isLoading: false });
// Send to API and get microdust
} catch (error) {
Alert.alert("Can't find you.", "Try Again.")
}
};
componentDidMount(){
this.getLocation();
};
render() {
const { isLoading } = this.state;
return isLoading ? <Loading /> : null;
};
}