Skip to content

Latest commit

 

History

History
25 lines (17 loc) · 774 Bytes

useGeolocation.md

File metadata and controls

25 lines (17 loc) · 774 Bytes

useGeolocation

React Native API 🎣 for the use of navigator.geolocation. It will return the initial state from getCurrentPosition. Watching can be setup as well.

Usage

Parameters

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});