-
Notifications
You must be signed in to change notification settings - Fork 0
/
MainContainer.js
114 lines (106 loc) · 2.92 KB
/
MainContainer.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
import * as React from "react";
import { StyleSheet } from "react-native";
import { NavigationContainer } from "@react-navigation/native";
import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
// import { createStackNavigator } from "@react-navigation/stack";
import { LinearGradient } from "expo-linear-gradient";
import { colors } from "./utils/index";
import { enableScreens } from "react-native-screens";
import { MaterialCommunityIcons } from "@expo/vector-icons";
const { PRIMARY_COLOR, SECONDARY_COLOR } = colors;
enableScreens(false);
// Screens
import CScreen from "./screens/CScreen";
import FScreen from "./screens/FScreen";
import ForecastScreen from "./screens/Forecast";
//Screen names
const cName = "Celsius";
const fName = "Fahrenheit";
const forecastName = "Forecast";
const Tab = createBottomTabNavigator();
// const CStack = createStackNavigator();
// const FStack = createStackNavigator();
export default function MainContainer({ navigation }) {
return (
<LinearGradient
colors={["#0f0c29", "#302b63", "#24243e"]}
start={{ x: 1, y: 1 }}
end={{ x: 2, y: 2 }}
style={styles.container}
>
<NavigationContainer>
<Tab.Navigator
initialRouteName={cName}
screenOptions={({ route }) => ({
tabBarIcon: ({ focused, color, size }) => {
let rn = route.name;
if (rn === cName) {
return (
<MaterialCommunityIcons
name="temperature-celsius"
size={30}
color={PRIMARY_COLOR}
/>
);
} else if (rn === fName) {
return (
<MaterialCommunityIcons
name="temperature-fahrenheit"
size={30}
color={PRIMARY_COLOR}
/>
);
} else if (rn === forecastName) {
return (
<MaterialCommunityIcons
name="format-list-bulleted-square"
size={30}
color={PRIMARY_COLOR}
/>
);
}
// You can return any component that you like here!
},
tabBarStyle: {
backgroundColor: "transparent",
borderTopColor: "transparent",
},
tabBarActiveTintColor: PRIMARY_COLOR,
tabBarInactiveTintColor: SECONDARY_COLOR,
labelStyle: {
paddingBottom: 10,
fontSize: 10,
},
headerShown: false,
})}
>
<Tab.Screen name={cName} component={CScreen} />
<Tab.Screen name={fName} component={FScreen} />
<Tab.Screen
name={forecastName}
component={ForecastScreen}
/>
</Tab.Navigator>
</NavigationContainer>
</LinearGradient>
);
}
// const HomeStackScreen = ({ navigation }) => (
// <HomeStack.Navigator>
// <HomeStack.Screen
// name={homeName}
// component={HomeScreen}
// options={{
// title: "Overview",
// headerShown: false,
// }}
// />
// </HomeStack.Navigator>
// );
const styles = StyleSheet.create({
container: {
flex: 1,
// backgroundColor: "purple",
justifyContent: "center",
},
});