-
Notifications
You must be signed in to change notification settings - Fork 0
/
App.js
executable file
·106 lines (91 loc) · 2.77 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
import React from 'react';
import { StyleSheet, Text, View } from 'react-native';
import {NavigationContainer,DefaultTheme,DarkTheme,useTheme} from '@react-navigation/native'
import {createStackNavigator} from '@react-navigation/stack'
import {createBottomTabNavigator} from '@react-navigation/bottom-tabs'
import {MaterialIcons} from '@expo/vector-icons'
import Constant from 'expo-constants'
import Home from './src/screens/Home';
import Search from './src/screens/Search'
import VideoPlayer from './src/screens/VideoPlayer'
import Explore from './src/screens/Explore'
import Suscribe from './src/screens/Suscribe'
import {reducer} from './src/reducers/reducer'
import {themeReducer} from './src/reducers/themeReducer'
import {Provider,useSelector} from 'react-redux'
import {createStore,combineReducers} from 'redux'
const customDarkTheme={
...DarkTheme,
colors:{
...DarkTheme.colors,
headerColor:"#404040",
iconColor:"white",
tabIcon:"white"
}
}
const customDefaultTheme={
...DefaultTheme,
colors:{
...DefaultTheme.colors,
headerColor:"white",
iconColor:"black",
tabIcon:"red"
}
}
const rooReducer = combineReducers({
cardData:reducer, //[],
myDarMode:themeReducer//false
})
const store = createStore(rooReducer)
const Stack = createStackNavigator()
const Tabs = createBottomTabNavigator()
const RootHome = ()=>{
const {colors} = useTheme()
return(
<Tabs.Navigator
screenOptions={({ route }) => ({
tabBarIcon: ({ color }) => {
let iconName;
if (route.name === 'home') {
iconName = 'home';
} else if (route.name === 'explore') {
iconName = 'explore';
}else if(route.name === 'suscribe'){
iconName = 'subscriptions'
}
// You can return any component that you like here!
return <MaterialIcons name={iconName} size={32} color={color} />;
},
})}
tabBarOptions={{
activeTintColor: colors.tabIcon,
inactiveTintColor: 'gray',
}}
>
<Tabs.Screen name="home" component={Home} />
<Tabs.Screen name="explore" component={Explore} />
<Tabs.Screen name="suscribe" component={Suscribe} />
</Tabs.Navigator>
)
}
export default App = ()=>{
return(
<Provider store={store}>
<Navigation />
</Provider>
)
}
export function Navigation() {
let currentTheme = useSelector(state=>{
return state.myDarMode
})
return (
<NavigationContainer theme={currentTheme?customDarkTheme:customDefaultTheme}>
<Stack.Navigator headerMode="none">
<Stack.Screen name="rootHome" component={RootHome} />
<Stack.Screen name="search" component={Search} />
<Stack.Screen name="videoplayer" component={VideoPlayer} />
</Stack.Navigator>
</NavigationContainer>
);
}