|
|
@ -26,9 +26,6 @@ import { connect } from "formik"; |
|
|
|
import colors from "./app/config/colors"; |
|
|
|
import { dimensions } from "./app/config/dimensions"; |
|
|
|
|
|
|
|
|
|
|
|
SplashScreen.preventAutoHideAsync(); |
|
|
|
|
|
|
|
export default function App() { |
|
|
|
const [user, setUser] = useState(); |
|
|
|
const [pluviometerStation, setPluviometerStation] = useState(undefined); |
|
|
@ -107,15 +104,25 @@ export default function App() { |
|
|
|
}, [pluviometerStation]); |
|
|
|
|
|
|
|
useEffect(()=>{ |
|
|
|
|
|
|
|
const restoreUser = async () => { |
|
|
|
await SplashScreen.preventAutoHideAsync(); |
|
|
|
|
|
|
|
const storageUser = await authStorage.getUser(); |
|
|
|
if (storageUser) setUser(storageUser); |
|
|
|
|
|
|
|
global.location = await getLocation(); |
|
|
|
SplashScreen.hideAsync(); |
|
|
|
setIsReady(true) |
|
|
|
await SplashScreen.hideAsync(); |
|
|
|
}; |
|
|
|
restoreUser() |
|
|
|
}) |
|
|
|
},[]) |
|
|
|
|
|
|
|
|
|
|
|
if(!isReady) { |
|
|
|
|
|
|
|
return null |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
if (global.formsSockets === undefined) |
|
|
|
global.formsSockets = useFiltering( |
|
|
@ -141,4 +148,5 @@ export default function App() { |
|
|
|
</CurrentLocationProvider> |
|
|
|
</AuthContext.Provider> |
|
|
|
); |
|
|
|
} |
|
|
|
} |