-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
54 lines (46 loc) · 1.28 KB
/
App.tsx
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
47
48
49
50
51
52
53
54
import React, { useState, useEffect } from 'react';
import { StyleSheet, ScrollView, View, SafeAreaView, StatusBar } from 'react-native';
import SupplyRateList from './SupplyRates/SupplyRateList'
import Rewards from './Rewards/Rewards'
import getSupplyRates from './data/getSupplyRates';
import { TokenRate } from './types'
export default function App() {
const [supplyRates, setSupplyRates] = useState<TokenRate>({});
const loadSupplyRates = async () => {
try {
const supplyRates: TokenRate = await getSupplyRates();
setSupplyRates(supplyRates);
} catch (error) {}
};
useEffect(() => {
loadSupplyRates();
}, []);
return (
<SafeAreaView>
<ScrollView style={styles.container}>
{supplyRates && <SupplyRateList
supplyRates={supplyRates}
/>}
<View
style={{
borderBottomColor: '#E6E8FA',
borderBottomWidth: StyleSheet.hairlineWidth,
}}
/>
{supplyRates && <Rewards
supplyRates={supplyRates}
loadSupplyRates={loadSupplyRates}
/> }
</ScrollView>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
safeArea: {
flex: 1,
paddingTop: StatusBar.currentHeight,
},
container: {
backgroundColor: '#fff',
},
});