-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
82 lines (79 loc) · 2.59 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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
/* eslint react/jsx-filename-extension: 0 */
import React, { useState } from 'react';
import {
SafeAreaView, useColorScheme, Linking, StyleSheet,
} from 'react-native';
import * as eva from '@eva-design/eva';
import {
ApplicationProvider, IconRegistry, Button, Icon, Layout,
} from '@ui-kitten/components';
import Constants from 'expo-constants';
import { EvaIconsPack } from '@ui-kitten/eva-icons';
import { Fontisto } from '@expo/vector-icons';
import {
HashRouter as Router,
Switch,
Route,
} from 'react-router-dom';
import UploadView from './components/UploadView';
import CollectionView from './components/CollectionView';
const styles = StyleSheet.create({
container: {
flex: 1, paddingTop: Constants.statusBarHeight,
},
bottomBarContainer: {
flex: 0.1, flexDirection: 'row', justifyContent: 'center', alignItems: 'center',
},
linkButton: {
width: 50,
margin: 5,
},
themeButton: {
zIndex: 10, height: 50, aspectRatio: 1, marginTop: Constants.statusBarHeight + 10, position: 'absolute', right: 10,
},
});
export default function App() {
const [theme, setTheme] = useState(useColorScheme() === 'dark' ? eva.dark : eva.light);
return (
<>
<IconRegistry icons={EvaIconsPack} />
<ApplicationProvider {...eva} theme={theme}>
<SafeAreaView style={styles.container}>
<Router>
<Switch>
<Route path="/collections/:id" component={CollectionView} />
<Route path="/" component={UploadView} />
</Switch>
<Layout style={styles.bottomBarContainer}>
<Button
style={styles.linkButton}
onPress={() => {
Linking.openURL('https://discord.gg/xFRt2rpyq4');
}}
accessoryLeft={<Fontisto size={24} color="white" name="discord" />}
/>
<Button
style={styles.linkButton}
onPress={() => {
Linking.openURL('https://twitter.com/swift_mint');
}}
accessoryLeft={<Fontisto size={18} color="white" name="twitter" />}
/>
</Layout>
<Button
onPress={() => {
if (theme === eva.dark) {
setTheme(eva.light);
} else {
setTheme(eva.dark);
}
}}
style={styles.themeButton}
accessoryLeft={<Icon name={theme === eva.dark ? 'moon-outline' : 'sun-outline'} />}
/>
</Router>
</SafeAreaView>
</ApplicationProvider>
</>
);
}