Skip to content

Commit df0ec08

Browse files
authored
Merge pull request #47 from creativetimofficial/v1.9.0
Feature v.1.9.0
2 parents 4262332 + c38eec6 commit df0ec08

File tree

4 files changed

+68
-100
lines changed

4 files changed

+68
-100
lines changed

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+
}

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,9 @@
1+
## [1.9.0] 2022 - 08 - 01
2+
- dependencies updated
3+
- expo version updated
4+
- react native version updated
5+
- implement expo-splash-screen for splash loading
6+
17
## [1.8.1] 2022-07-19
28

39
### Updated dependencies

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# [Argon React Native](https://creativetimofficial.github.io/argon-react-native/docs/#) [![Tweet](https://img.shields.io/twitter/url/http/shields.io.svg?style=social&logo=twitter)](https://twitter.com/home?status=Argon%20React%20Native,%20a%20cool%20Argon%20React%20Native%20App%20Template%20%E2%9D%A4%EF%B8%8F%20https%3A//bit.ly/2KAj86H%20%23reactnative%20%23argon%20%23designsystem%20%23developers%20via%20%40CreativeTim)
22

33

4-
![version](https://img.shields.io/badge/version-1.8.0-blue.svg) [![GitHub issues open](https://img.shields.io/github/issues/creativetimofficial/argon-react-native.svg?style=flat)](https://github.com/creativetimofficial/argon-react-native/issues?q=is%3Aopen+is%3Aissue) [![GitHub issues closed](https://img.shields.io/github/issues-closed-raw/creativetimofficial/argon-react-native.svg?maxAge=2592000)](https://github.com/creativetimofficial/argon-react-native/issues?q=is%3Aissue+is%3Aclosed)
4+
![version](https://img.shields.io/badge/version-1.9.0-blue.svg) [![GitHub issues open](https://img.shields.io/github/issues/creativetimofficial/argon-react-native.svg?style=flat)](https://github.com/creativetimofficial/argon-react-native/issues?q=is%3Aopen+is%3Aissue) [![GitHub issues closed](https://img.shields.io/github/issues-closed-raw/creativetimofficial/argon-react-native.svg?maxAge=2592000)](https://github.com/creativetimofficial/argon-react-native/issues?q=is%3Aissue+is%3Aclosed)
55

66

77
![Product Gif](https://raw.githubusercontent.com/creativetimofficial/public-assets/master/argon-react-native/arg-rn-thumbnail.jpg)

package.json

Lines changed: 16 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,31 @@
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",
29+
"expo-splash-screen": "^0.18.2",
2930
"galio-framework": "^0.8.0",
3031
"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"
32+
"react": "18.2.0",
33+
"react-native": "0.71.8",
34+
"react-native-gesture-handler": "~2.9.0",
35+
"react-native-modal-dropdown": "1.0.2",
36+
"react-native-reanimated": "~2.14.4",
37+
"react-native-safe-area-context": "4.5.0",
38+
"react-native-screens": "~3.20.0"
3839
},
3940
"devDependencies": {
40-
"babel-preset-expo": "~9.1.0"
41+
"babel-preset-expo": "^9.3.0"
4142
},
4243
"keywords": [
4344
"argon react native",

0 commit comments

Comments
 (0)