Browse Source

fixing ViewPropTypes error in the splash-screen and the expo-doctor error

master
Joselito Lima 1 year ago
parent
commit
00c7f74677
  1. 77
      src/App.js
  2. 14
      src/package.json

77
src/App.js

@ -3,7 +3,7 @@ import { NavigationContainer } from "@react-navigation/native";
import navigationTheme from "./app/navigation/navigationTheme"; import navigationTheme from "./app/navigation/navigationTheme";
import "./app/config/globals.js"; import "./app/config/globals.js";
import AppLoading from "expo-app-loading";
import * as SplashScreen from 'expo-splash-screen';
import FlashMessage, { import FlashMessage, {
showMessage, showMessage,
hideMessage, hideMessage,
@ -26,6 +26,9 @@ import { connect } from "formik";
import colors from "./app/config/colors"; import colors from "./app/config/colors";
import { dimensions } from "./app/config/dimensions"; import { dimensions } from "./app/config/dimensions";
SplashScreen.preventAutoHideAsync();
export default function App() { export default function App() {
const [user, setUser] = useState(); const [user, setUser] = useState();
const [pluviometerStation, setPluviometerStation] = useState(undefined); const [pluviometerStation, setPluviometerStation] = useState(undefined);
@ -103,45 +106,39 @@ export default function App() {
} }
}, [pluviometerStation]); }, [pluviometerStation]);
const restoreUser = async () => {
const storageUser = await authStorage.getUser();
if (storageUser) setUser(storageUser);
global.location = await getLocation();
};
if (!isReady) {
return (
<AppLoading
startAsync={restoreUser}
onFinish={() => setIsReady(true)}
onError={(e) => console.log(e)}
/>
useEffect(()=>{
const restoreUser = async () => {
const storageUser = await authStorage.getUser();
if (storageUser) setUser(storageUser);
global.location = await getLocation();
SplashScreen.hideAsync();
};
restoreUser()
})
if (global.formsSockets === undefined)
global.formsSockets = useFiltering(
global.location || global.defaultLocation
); );
} else {
if (global.formsSockets === undefined)
global.formsSockets = useFiltering(
global.location || global.defaultLocation
);
return (
<AuthContext.Provider
value={{
user,
setUser,
}}
>
<CurrentLocationProvider>
<EventLocationProvider>
<MapDataProvider>
<NavigationContainer theme={navigationTheme}>
{user ? <AppNavigator /> : <AuthNavigator />}
<FlashMessage position="top" />
</NavigationContainer>
</MapDataProvider>
</EventLocationProvider>
</CurrentLocationProvider>
</AuthContext.Provider>
);
}
return (
<AuthContext.Provider
value={{
user,
setUser,
}}
>
<CurrentLocationProvider>
<EventLocationProvider>
<MapDataProvider>
<NavigationContainer theme={navigationTheme}>
{user ? <AppNavigator /> : <AuthNavigator />}
<FlashMessage position="top" />
</NavigationContainer>
</MapDataProvider>
</EventLocationProvider>
</CurrentLocationProvider>
</AuthContext.Provider>
);
} }

14
src/package.json

@ -30,13 +30,14 @@
"eslint": "^8.1.0", "eslint": "^8.1.0",
"eslint-plugin-react": "^7.26.1", "eslint-plugin-react": "^7.26.1",
"expo": "^49.0.0", "expo": "^49.0.0",
"expo-app-loading": "~1.2.1",
"expo-app-loading": "^2.1.1",
"expo-asset": "~8.10.1", "expo-asset": "~8.10.1",
"expo-file-system": "~15.4.4", "expo-file-system": "~15.4.4",
"expo-image-picker": "~14.3.2", "expo-image-picker": "~14.3.2",
"expo-location": "~16.1.0", "expo-location": "~16.1.0",
"expo-permissions": "~14.2.1", "expo-permissions": "~14.2.1",
"expo-secure-store": "~12.3.1", "expo-secure-store": "~12.3.1",
"expo-splash-screen": "~0.20.5",
"expo-sqlite": "~11.3.3", "expo-sqlite": "~11.3.3",
"expo-status-bar": "~1.6.0", "expo-status-bar": "~1.6.0",
"formik": "^2.2.9", "formik": "^2.2.9",
@ -67,7 +68,6 @@
"react-native-simple-dialogs": "^1.4.0", "react-native-simple-dialogs": "^1.4.0",
"react-native-svg": "13.9.0", "react-native-svg": "13.9.0",
"react-native-svg-transformer": "^0.14.3", "react-native-svg-transformer": "^0.14.3",
"react-native-svg-uri": "^1.2.3",
"react-native-walkthrough-tooltip": "^1.3.0", "react-native-walkthrough-tooltip": "^1.3.0",
"react-native-web": "~0.19.6", "react-native-web": "~0.19.6",
"react-native-webview": "13.2.2", "react-native-webview": "13.2.2",
@ -84,5 +84,15 @@
"@babel/core": "^7.12.9", "@babel/core": "^7.12.9",
"jest-expo": "^43.0.0" "jest-expo": "^43.0.0"
}, },
"overrides": {
"@expo/config-plugins": "~7.2.2",
"@expo/prebuild-config": "~6.2.4",
"expo-modules-autolinking": "~1.5.0"
},
"resolutions": {
"@expo/config-plugins": "~7.2.2",
"@expo/prebuild-config": "~6.2.4",
"expo-modules-autolinking": "~1.5.0"
},
"private": true "private": true
} }
Loading…
Cancel
Save