-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
55 lines (39 loc) · 1.5 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
/**
* covid19_dashboard copyright © 2020
* Created by mauromarini on 18/07/2020
* Repository: http://github.com/marinimau/covid19_dashboard
* Location: Baratili San Pietro
*/
import React from 'react';
import Async from 'react-async';
import Records from "./src/logic/dataset";
import {enableScreens} from 'react-native-screens';
import retrieveData from "./src/logic/retrieveData";
import ErrorScreen from "./src/ui/components/loading/error";
import retrieveRegionData from "./src/logic/retrieveRegionData";
import LoadingComponent from "./src/ui/components/loading/loading";
import GlobalContainer from "./src/ui/components/GlobalContainer";
enableScreens();
export default function App() {
return (
<Async promiseFn={retrieveData}>
{({data, err, isLoading}) => {
if (isLoading) return <LoadingComponent/>
if (err) return <ErrorScreen/>
if (data) Records.setRecords(data)
return (
<Async promiseFn={retrieveRegionData}>
{({data, err, isLoading}) => {
if (isLoading) return <LoadingComponent/>
if (err) return <ErrorScreen/>
if (data) Records.setRegionRecords(data)
return (
<GlobalContainer />
)
}}
</Async>
)
}}
</Async>
);
}