This repository has been archived by the owner on Jul 18, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
App.js
116 lines (108 loc) · 3.55 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
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
import { StatusBar } from "expo-status-bar";
import "react-native-gesture-handler";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import { NavigationContainer } from "@react-navigation/native";
import React, { useEffect, useState } from "react";
import { Ionicons } from "@expo/vector-icons";
import { StyleSheet, Text, View } from "react-native";
import { Home, Search, Favorites, Settings } from "./pages/index";
import { createStackNavigator } from "@react-navigation/stack";
import { WatchRoom, EpisodeRoom, InfoRoom } from "./rooms/index";
import { Orientation } from "expo-screen-orientation";
import {
isInialized,
firebaseConfig,
signInAnonymously,
} from "./src/firebase.js";
const Stack = createStackNavigator();
const Tab = createBottomTabNavigator();
const BottomTab = ({ navigation, truthy, setTruthy }) => {
return (
<Tab.Navigator
initialRouteName="home"
screenOptions={({ route }) => ({
tabBarShowLabel: false,
headerShown: false,
tabBarIcon: ({ focused, color, size }) => {
let iconName;
if (route.name === "home") {
iconName = focused ? "home" : "home-outline";
} else if (route.name === "search") {
iconName = focused ? "search" : "search-outline";
} else if (route.name === "favorites") {
iconName = focused ? "star" : "star-outline";
} else if (route.name === "settings") {
iconName = focused ? "ios-cog" : "ios-cog-outline";
}
return <Ionicons name={iconName} size={size} color={color} />;
},
tabBarActiveTintColor: "#0367fc",
tabBarInactiveTintColor: "gray",
tabBarStyle: {
backgroundColor: "#1a1a1a",
borderTopWidth: 0,
},
})}
>
<Tab.Screen name="home">
{(props) => <Home {...props} navigate={navigation} truth={truthy} />}
</Tab.Screen>
<Tab.Screen name="search">
{(props) => <Search {...props} navigate={navigation} truth={truthy} />}
</Tab.Screen>
<Tab.Screen name="favorites">
{(props) => (
<Favorites {...props} navigate={navigation} truth={truthy} />
)}
</Tab.Screen>
<Tab.Screen name="settings">
{(props) => (
<Settings
{...props}
navigate={navigation}
truth={truthy}
truthSet={setTruthy}
/>
)}
</Tab.Screen>
</Tab.Navigator>
);
};
export default function App() {
const [truthy, setTruthy] = useState(true);
isInialized(firebaseConfig);
useEffect(() => {
signInAnonymously();
});
return (
<NavigationContainer>
<Stack.Navigator
initialRouteName="BottomTab"
screenOptions={{ tabBarShowLabel: false, headerShown: false }}
>
<Stack.Screen name="BottomTab">
{(props) => (
<BottomTab {...props} truthy={truthy} setTruthy={setTruthy} />
)}
</Stack.Screen>
<Stack.Screen name="EpisodeRoom">
{(props) => <EpisodeRoom {...props} truthy={truthy} />}
</Stack.Screen>
<Stack.Screen name="WatchRoom">
{(props) => <WatchRoom {...props} truthy={truthy} />}
</Stack.Screen>
{/*<Stack.Screen name="InfoRoom">
{(props) => <InfoRoom {...props} truthy={truthy} />}
</Stack.Screen>*/}
</Stack.Navigator>
</NavigationContainer>
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
backgroundColor: "#e6e6e6",
alignItems: "center",
justifyContent: "center",
},
});