Browse Source

Refac useLocation for default location latlong arg

master
GabrielTrettel 4 years ago
parent
commit
dbcf9625cd
  1. 8
      src/app/hooks/useLocation.js

8
src/app/hooks/useLocation.js

@ -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;
};
}
Loading…
Cancel
Save