I have 2 function calls:
const result = _checkPermissions();
if (result === 'granted') {
this._googleSignIn();
}
I want _checkPermissions()
to return before I run the if statement.....however I cant seem to do this and code just continues on to if statement before _checkPermissions()
has returned.
I know its got something to do with async await but i cant figure it out
Below is code for _checkPermissions()
export const _checkPermissions = async () => {
const result = await check(
Platform.select({
android: PERMISSIONS.ANDROID.ACCESS_FINE_LOCATION,
ios: PERMISSIONS.IOS.LOCATION_WHEN_IN_USE,
}),
);
switch (result) {
case 'blocked':
return 'blocked';
case 'granted':
return 'granted';