Created
February 7, 2016 06:23
-
-
Save dhrrgn/26e7badfe7a2b392c059 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// import Setting from React up here | |
function setHasLocationPermission(hasPerm) { | |
Settings.set({hasLocationPermission: hasPerm}); | |
} | |
navigator.geolocation.getCurrentPosition( | |
(position) => setHasLocationPermission(true), | |
(error) => { | |
switch(error.code) { | |
case error.PERMISSION_DENIED: | |
setHasLocationPermission(false); | |
break; | |
case error.POSITION_UNAVAILABLE: | |
case error.TIMEOUT: | |
// Do something here like try again... | |
break; | |
} | |
} | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment