-
Notifications
You must be signed in to change notification settings - Fork 0
/
Layout.tsx
143 lines (134 loc) · 4.69 KB
/
Layout.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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
import React, { useState, useEffect } from 'react';
import { View, Text, StyleSheet, TouchableOpacity, ScrollView } from 'react-native';
import Ionicons from '@expo/vector-icons/Ionicons';
import Entypo from '@expo/vector-icons/Entypo';
import MaterialIcons from '@expo/vector-icons/MaterialIcons';
import FontAwesome from '@expo/vector-icons/FontAwesome';
import Home from './pages/Home';
const Layout = () => {
const [minutes, setMinutes] = useState(0);
const [currentPage, setCurrentPage] = useState('Home');
useEffect(() => {
const timer = setInterval(() => {
setMinutes((prevMinutes) => prevMinutes + 1);
}, 60000);
return () => clearInterval(timer);
}, []);
const renderContent = () => {
if (currentPage === 'Home') {
return <Home />;
} else {
return (
<View style={styles.otherContent}>
<Text style={styles.mainText}>{currentPage} is Opened!</Text>
</View>
);
}
};
return (
<View style={styles.container}>
<View style={styles.topMenu}>
<TouchableOpacity style={styles.topMenuItem}>
<Text style={styles.topMenuText}>🕒 {minutes} min</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.topMenuItem}>
<Text style={styles.topMenuText}>For You</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.topMenuItem}>
<Text style={styles.topMenuText}>
<FontAwesome name="search" size={24} color="white" />
</Text>
</TouchableOpacity>
</View>
{renderContent()}
<View style={styles.bottomMenu}>
<TouchableOpacity style={styles.bottomMenuItem} onPress={() => setCurrentPage('Home')}>
<Ionicons name="home" size={24} color="white" />
<Text style={styles.bottomMenuText}>Home</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.bottomMenuItem} onPress={() => setCurrentPage('Discover')}>
<Entypo name="compass" size={24} color="white" />
<Text style={styles.bottomMenuText}>Discover</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.bottomMenuItem} onPress={() => setCurrentPage('Activity')}>
<MaterialIcons name="timer" size={24} color="white" />
<Text style={styles.bottomMenuText}>Activity</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.bottomMenuItem} onPress={() => setCurrentPage('Bookmarks')}>
<FontAwesome name="bookmark" size={24} color="white" />
<Text style={styles.bottomMenuText}>Bookmarks</Text>
</TouchableOpacity>
<TouchableOpacity style={styles.bottomMenuItem} onPress={() => setCurrentPage('Profile')}>
<FontAwesome name="user-circle-o" size={24} color="white" />
<Text style={styles.bottomMenuText}>Profile</Text>
</TouchableOpacity>
</View>
</View>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: '#000',
},
topMenu: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingHorizontal: 0,
paddingVertical: 10,
position: 'absolute',
top: 50,
left: 0,
right: 0,
zIndex: 10,
backgroundColor: 'transparent',
},
topMenuItem: {
flex: 1,
alignItems: 'center',
},
topMenuText: {
color: '#fff',
fontSize: 16,
},
mainContent: {
padding: 20,
paddingTop: 120,
flex: 1,
alignItems: 'center',
backgroundColor: '#132f30',
},
mainText: {
color: '#fff',
fontSize: 18,
marginVertical: 10,
},
otherContent: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: '#132f30',
},
bottomMenu: {
flexDirection: 'row',
justifyContent: 'space-between',
paddingHorizontal: 10,
paddingVertical: 15,
backgroundColor: '#000',
borderTopColor: '#959aa1',
borderTopWidth: 1,
marginBottom: 20,
height: 70,
},
bottomMenuItem: {
flex: 1,
alignItems: 'center',
justifyContent: 'center',
},
bottomMenuText: {
color: '#fff',
fontSize: 12,
marginTop: 6,
},
});
export default Layout;