|
@ -1,8 +1,10 @@ |
|
|
import { useEffect, useState } from "react"; |
|
|
import { useEffect, useState } from "react"; |
|
|
import * as Location from "expo-location"; |
|
|
import * as Location from "expo-location"; |
|
|
|
|
|
|
|
|
export default useLocation = () => { |
|
|
|
|
|
const [location, setLocation] = useState({ longitude: 0.0, latitude: 0.0 }); |
|
|
|
|
|
|
|
|
export default function useLocation( |
|
|
|
|
|
defaultLocation = { longitude: 0.0, latitude: 0.0 } |
|
|
|
|
|
) { |
|
|
|
|
|
const [location, setLocation] = useState(defaultLocation); |
|
|
|
|
|
|
|
|
const getLocation = async () => { |
|
|
const getLocation = async () => { |
|
|
try { |
|
|
try { |
|
@ -22,4 +24,4 @@ export default useLocation = () => { |
|
|
}, []); |
|
|
}, []); |
|
|
|
|
|
|
|
|
return location; |
|
|
return location; |
|
|
}; |
|
|
|
|
|
|
|
|
} |