Skip to content

Commit 05baf8c

Browse files
author
taqishah1214
committed
Upgrage packages
1 parent 4262332 commit 05baf8c

2 files changed

Lines changed: 60 additions & 99 deletions

File tree

App.js

Lines changed: 45 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
import React, {useState} from "react";
1+
import React, { useCallback, useEffect, useState } from "react";
22
import { Image } from "react-native";
3-
import AppLoading from "expo-app-loading";
4-
import { useFonts } from '@use-expo/font';
3+
import * as SplashScreen from "expo-splash-screen";
4+
import * as Font from "expo-font";
55
import { Asset } from "expo-asset";
66
import { Block, GalioProvider } from "galio-framework";
77
import { NavigationContainer } from "@react-navigation/native";
@@ -21,14 +21,13 @@ const assetImages = [
2121
Images.Pro,
2222
Images.ArgonLogo,
2323
Images.iOSLogo,
24-
Images.androidLogo
24+
Images.androidLogo,
2525
];
26-
2726
// cache product images
28-
articles.map(article => assetImages.push(article.image));
27+
articles.map((article) => assetImages.push(article.image));
2928

3029
function cacheImages(images) {
31-
return images.map(image => {
30+
return images.map((image) => {
3231
if (typeof image === "string") {
3332
return Image.prefetch(image);
3433
} else {
@@ -37,87 +36,49 @@ function cacheImages(images) {
3736
});
3837
}
3938

40-
export default props => {
41-
const [isLoadingComplete, setLoading] = useState(false);
42-
let [fontsLoaded] = useFonts({
43-
'ArgonExtra': require('./assets/font/argon.ttf'),
44-
});
39+
export default function App() {
40+
const [appIsReady, setAppIsReady] = useState(false);
4541

46-
function _loadResourcesAsync() {
47-
return Promise.all([...cacheImages(assetImages)]);
48-
}
42+
useEffect(() => {
43+
async function prepare() {
44+
try {
45+
//Load Resources
46+
await _loadResourcesAsync();
47+
// Pre-load fonts, make any API calls you need to do here
48+
await Font.loadAsync({
49+
ArgonExtra: require("./assets/font/argon.ttf"),
50+
});
51+
} catch (e) {
52+
console.warn(e);
53+
} finally {
54+
// Tell the application to render
55+
setAppIsReady(true);
56+
}
57+
}
58+
prepare();
59+
}, []);
4960

50-
function _handleLoadingError(error) {
51-
// In this case, you might want to report the error to your error
52-
// reporting service, for example Sentry
53-
console.warn(error);
61+
const _loadResourcesAsync = async () => {
62+
return Promise.all([...cacheImages(assetImages)]);
5463
};
5564

56-
function _handleFinishLoading() {
57-
setLoading(true);
58-
};
65+
const onLayoutRootView = useCallback(async () => {
66+
if (appIsReady) {
67+
await SplashScreen.hideAsync();
68+
}
69+
}, [appIsReady]);
5970

60-
if(!fontsLoaded && !isLoadingComplete) {
61-
return (
62-
<AppLoading
63-
startAsync={_loadResourcesAsync}
64-
onError={_handleLoadingError}
65-
onFinish={_handleFinishLoading}
66-
/>
67-
);
68-
} else if(fontsLoaded) {
69-
return (
70-
<NavigationContainer>
71-
<GalioProvider theme={argonTheme}>
72-
<Block flex>
73-
<Screens />
74-
</Block>
75-
</GalioProvider>
76-
</NavigationContainer>
77-
);
78-
} else {
79-
return null
71+
if (!appIsReady) {
72+
return null;
8073
}
81-
}
82-
83-
// export default class App extends React.Component {
84-
// state = {
85-
// isLoadingComplete: false
86-
// };
87-
88-
// render() {
89-
// if (!this.state.isLoadingComplete) {
90-
// return (
91-
// <AppLoading
92-
// startAsync={this._loadResourcesAsync}
93-
// onError={this._handleLoadingError}
94-
// onFinish={this._handleFinishLoading}
95-
// />
96-
// );
97-
// } else {
98-
// return (
99-
// <NavigationContainer>
100-
// <GalioProvider theme={argonTheme}>
101-
// <Block flex>
102-
// <Screens />
103-
// </Block>
104-
// </GalioProvider>
105-
// </NavigationContainer>
106-
// );
107-
// }
108-
// }
10974

110-
// _loadResourcesAsync = async () => {
111-
// return Promise.all([...cacheImages(assetImages)]);
112-
// };
113-
114-
// _handleLoadingError = error => {
115-
// // In this case, you might want to report the error to your error
116-
// // reporting service, for example Sentry
117-
// console.warn(error);
118-
// };
119-
120-
// _handleFinishLoading = () => {
121-
// this.setState({ isLoadingComplete: true });
122-
// };
123-
// }
75+
return (
76+
<NavigationContainer onReady={onLayoutRootView}>
77+
<GalioProvider theme={argonTheme}>
78+
<Block flex>
79+
<Screens />
80+
</Block>
81+
</GalioProvider>
82+
</NavigationContainer>
83+
);
84+
}

package.json

Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "argon-react-native",
3-
"version": "1.8.0",
3+
"version": "1.9.0",
44
"description": "Argon React Native, based on Argon Design System. Coded by Creative Tim",
55
"main": "node_modules/expo/AppEntry.js",
66
"scripts": {
@@ -14,30 +14,30 @@
1414
"url": "git+https://github.com/creativetimofficial/argon-react-native.git"
1515
},
1616
"dependencies": {
17-
"@react-native-masked-view/masked-view": "0.2.6",
17+
"@react-native-masked-view/masked-view": "0.2.8",
1818
"@react-navigation/bottom-tabs": "^6.3.1",
1919
"@react-navigation/compat": "^5.1.25",
20-
"@react-navigation/drawer": "5.12.4",
20+
"@react-navigation/drawer": "6.4.1",
2121
"@react-navigation/native": "^6.0.10",
2222
"@react-navigation/stack": "^6.2.1",
2323
"@use-expo/font": "^2.0.0",
24-
"expo": "^45.0.0",
24+
"expo": "^48.0.16",
2525
"expo-app-loading": "~2.0.0",
26-
"expo-asset": "~8.5.0",
27-
"expo-font": "~10.1.0",
28-
"expo-modules-core": "~0.9.2",
26+
"expo-asset": "~8.9.1",
27+
"expo-font": "~11.1.1",
28+
"expo-modules-core": "~1.2.7",
2929
"galio-framework": "^0.8.0",
3030
"prop-types": "^15.7.2",
31-
"react": "17.0.2",
32-
"react-native": "0.68.2",
33-
"react-native-gesture-handler": "~2.2.1",
34-
"react-native-modal-dropdown": "git+https://github.com/siemiatj/react-native-modal-dropdown.git",
35-
"react-native-reanimated": "~2.8.0",
36-
"react-native-safe-area-context": "4.2.4",
37-
"react-native-screens": "~3.11.1"
31+
"react": "18.2.0",
32+
"react-native": "0.71.8",
33+
"react-native-gesture-handler": "~2.9.0",
34+
"react-native-modal-dropdown": "1.0.2",
35+
"react-native-reanimated": "~2.14.4",
36+
"react-native-safe-area-context": "4.5.0",
37+
"react-native-screens": "~3.20.0"
3838
},
3939
"devDependencies": {
40-
"babel-preset-expo": "~9.1.0"
40+
"babel-preset-expo": "^9.3.0"
4141
},
4242
"keywords": [
4343
"argon react native",

0 commit comments

Comments
 (0)