Skip to content

Commit

Permalink
fix: update location access before login
Browse files Browse the repository at this point in the history
  • Loading branch information
geeekgod committed Feb 20, 2023
1 parent e82a728 commit 8259a8f
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions app/context/DataContext/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,16 +140,17 @@ const DataContextProvider = ({ children }) => {

useEffect(() => {
(async () => {
if (isAuth) {
let { status } = await Location.requestForegroundPermissionsAsync();
if (status !== 'granted') {
setErrorMsg('Permission to access location was denied');
return;
}

let { status } = await Location.requestForegroundPermissionsAsync();
if (status !== 'granted') {
setErrorMsg('Permission to access location was denied');
return;
let location = await Location.getCurrentPositionAsync({});
setLocation(location);
setTimeout(() => setLocation(null))
}

let location = await Location.getCurrentPositionAsync({});
setLocation(location);
setTimeout(() => setLocation(null))
})();
}, []);

Expand Down

0 comments on commit 8259a8f

Please sign in to comment.