This repository was archived by the owner on Dec 13, 2024. It is now read-only.
Repository navigation
Expand file tree
/
Copy pathApp.js
More file actions
155 lines (150 loc) · 3.57 KB
/
Copy pathApp.js
File metadata and controls
155 lines (150 loc) · 3.57 KB
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
import PopularComponent from "./PopularComponent";
import TopRatedComponent from "./TopRatedComponent";
import UpComingComponent from "./UpComingComponent";
import MovieDetailsComponent from "./MovieDetailsComponent";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import { createNativeStackNavigator } from "@react-navigation/native-stack";
import { Image, Text } from "react-native";
import React, { createContext } from "react";
const Tab = createBottomTabNavigator();
const Stack = createNativeStackNavigator();
const ApiContext = createContext("");
export { ApiContext };
const API_KEY = "2cece1b402fa756eebc6a469d8563b9f";
export default function App() {
if (API_KEY === "") {
return <Text style={{ color: "red" }}>ERROR: No API KEY</Text>;
}
return (
<ApiContext.Provider value={API_KEY}>
<NavigationContainer>
<Tab.Navigator
screenOptions={{
headerStyle: {
backgroundColor: "black",
borderBottomColor: "black",
},
headerTintColor: "#fff",
tabBarStyle: {
backgroundColor: "black",
borderTopColor: "black",
},
}}
>
<Tab.Screen
name="Popular"
options={{
headerTitle: "MovieInf - Popular movies",
tabBarIcon: ({ size }) => {
return (
<Image
style={{
width: size,
height: size,
}}
source={require("./assets/trend.png")}
/>
);
},
}}
>
{() => (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen
name="Popular movies"
component={PopularComponent}
/>
<Stack.Screen
name="Details"
component={MovieDetailsComponent}
screenOptions={{
headerShown: false,
}}
/>
</Stack.Navigator>
)}
</Tab.Screen>
<Tab.Screen
name="Top Rated"
options={{
headerTitle: "MovieInf - Top rated movies",
tabBarIcon: ({ size }) => {
return (
<Image
style={{
width: size,
height: size,
}}
source={require("./assets/white-star.png")}
/>
);
},
}}
>
{() => (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen
name="Top Rated"
component={TopRatedComponent}
/>
<Stack.Screen
name="Details"
component={MovieDetailsComponent}
screenOptions={{
headerShown: false,
}}
/>
</Stack.Navigator>
)}
</Tab.Screen>
<Tab.Screen
name="Up Coming"
options={{
headerTitle: "MovieInf - Up coming movies",
tabBarIcon: ({ size }) => {
return (
<Image
style={{
width: size,
height: size,
}}
source={require("./assets/upcoming.png")}
/>
);
},
}}
>
{() => (
<Stack.Navigator
screenOptions={{
headerShown: false,
}}
>
<Stack.Screen
name="Up Coming"
component={UpComingComponent}
/>
<Stack.Screen
name="Details"
component={MovieDetailsComponent}
screenOptions={{
headerShown: false,
}}
/>
</Stack.Navigator>
)}
</Tab.Screen>
</Tab.Navigator>
</NavigationContainer>
</ApiContext.Provider>
);
}