Created
May 1, 2020 23:22
-
-
Save renielsalvador/5857b6761d4e22aee6040e32c28afbdb 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 {useState, useEffect} from 'react'; | |
import {LocationEnabler} from 'utils'; | |
const useLocationEnabler = (): Array<boolean> => { | |
const [state, internalSetState] = useState<any>(false); | |
useEffect(() => { | |
LocationEnabler.checkLocationPermission().then(() => { | |
LocationEnabler.enableLocation(); | |
internalSetState(true); | |
}); | |
}, []); | |
return [state]; | |
}; | |
export default useLocationEnabler; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment