Guest User

Untitled

a guest
Jun 20th, 2018
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.51 KB | None | 0 0
  1. export const getCurrentLocation = (simulator) => {
  2. return async (dispatch) => {
  3. if (!simulator) {
  4. let { status } = await Permissions.askAsync(Permissions.LOCATION);
  5.  
  6. if (status !== 'granted') {
  7. dispatch(gotCurrentLocationError('Permission to access location was denied'))
  8. }
  9.  
  10. let location = await Location.getCurrentPositionAsync({});
  11. dispatch(gotCurrentLocation(location))
  12. } else {
  13. // Demo location for simulator
  14. dispatch(gotCurrentLocation(chicagoFSA))
  15. }
  16. }
  17. }
Add Comment
Please, Sign In to add comment