-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.tsx
176 lines (166 loc) · 4.9 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
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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
import {
DarkTheme,
NavigationContainer,
Theme,
useTheme,
} from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { HomeScreen } from "./src/screens/HomeScreen";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { Entypo } from "@expo/vector-icons";
import { Image, View } from "react-native";
import { Ionicons } from "@expo/vector-icons";
import { MaterialCommunityIcons } from "@expo/vector-icons";
import { Feather } from "@expo/vector-icons";
import { useSafeAreaInsets } from "react-native-safe-area-context";
import Animated, { useAnimatedStyle } from "react-native-reanimated";
import {
SharedValuesProvider,
useSharedValuesContext,
} from "./src/providers/SharedValuesProvider";
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator();
function HomeNavigator() {
const theme = useTheme();
const insets = useSafeAreaInsets();
const { opacity } = useSharedValuesContext();
const animatedStyles = useAnimatedStyle(() => {
return {
backgroundColor: `rgba(0, 0, 0, ${opacity.value * 0.8})`,
};
}, []);
return (
<Stack.Navigator>
<Stack.Screen
name="home"
component={HomeScreen}
options={{
header: () => {
return (
<Animated.View
style={[
animatedStyles,
{
position: "absolute",
top: 0,
left: 0,
right: 0,
paddingTop: insets.top,
paddingLeft: insets.left + 20,
paddingRight: insets.right + 20,
height: insets.top + 55,
flexDirection: "row",
alignItems: "center",
justifyContent: "space-between",
},
]}
>
<MaterialCommunityIcons
name="movie-open"
size={48}
color={theme.colors.primary}
/>
<View
style={{
flexDirection: "row",
alignItems: "center",
gap: 40,
}}
>
<Feather name="search" size={32} color={theme.colors.text} />
<Image
style={{
width: 30,
height: 30,
borderRadius: 5,
}}
source={{
uri: "https://pbs.twimg.com/profile_images/1506080366158831616/QtgYW8FL_400x400.jpg",
}}
/>
</View>
</Animated.View>
);
},
}}
/>
</Stack.Navigator>
);
}
const theme: Theme = {
...DarkTheme,
colors: {
...DarkTheme.colors,
primary: "red",
},
};
export default function App() {
return (
<SharedValuesProvider>
<NavigationContainer theme={theme}>
<Tab.Navigator initialRouteName="home-navigator">
<Tab.Screen
name="news-and-hot-navigator"
component={View}
options={{
headerShown: false,
title: "News & Hot",
tabBarIcon(props) {
return (
<Feather name="copy" size={props.size} color={props.color} />
);
},
}}
/>
<Tab.Screen
name="home-navigator"
component={HomeNavigator}
options={{
headerShown: false,
title: "Home",
tabBarIcon(props) {
return (
<Entypo name="home" size={props.size} color={props.color} />
);
},
}}
/>
<Tab.Screen
name="games-navigator"
component={View}
options={{
headerShown: false,
title: "Games",
tabBarIcon(props) {
return (
<Ionicons
name="game-controller-outline"
size={props.size}
color={props.color}
/>
);
},
}}
/>
<Tab.Screen
name="downloads-navigator"
component={View}
options={{
headerShown: false,
title: "Downloads",
tabBarIcon(props) {
return (
<MaterialCommunityIcons
name="download-circle-outline"
size={props.size}
color={props.color}
/>
);
},
}}
/>
</Tab.Navigator>
</NavigationContainer>
</SharedValuesProvider>
);
}