React Native API 🎣 for the use of navigator.geolocation
. It will return the initial state from getCurrentPosition
. Watching can be setup as well.
Passed in as a single object with the following keys
Parameter Key | Required | Default Value |
---|---|---|
success | ☑ | - |
error | ☑ | - |
options | {} | |
shouldWatch | False |
import {useGeolocation} from 'react-native-use'
const success = location => console.log(location)
const error = err => console.log(err)
useGeolocation({success, error, options: {enableHighAccuracy: true}, shouldWatch: true});