-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathApp.js
90 lines (85 loc) · 2.83 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
import 'react-native-gesture-handler';
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
import { NavigationContainer } from '@react-navigation/native';
import { useState } from 'react';
import PostModal from './components/post-modal';
import PostModalContext from './lib/contexts/post-modal';
import CatalogScreen from './screens/catalog';
import HomeScreen from './screens/home';
import RatingScreen from './screens/rating';
import SearchScreen from './screens/search';
const Tab = createBottomTabNavigator();
export default function App() {
const [ modal, setModal ] = useState({
open: false,
post: null,
});
const openModal = post => {
setModal({
open: true,
post: post,
});
}
const closeModal = () => {
setModal(prevState => ({
open: false,
post: prevState.post,
}));
}
return (
<PostModalContext.Provider value={{
openModal,
closeModal,
}}>
<NavigationContainer>
<Tab.Navigator
screenOptions={{
tabBarLabelPosition: 'beside-icon',
tabBarLabelStyle: {
marginLeft: 0,
fontWeight: '700',
fontSize: 18,
},
tabBarIconStyle: { display: 'none' },
tabBarActiveTintColor: '#333',
tabBarInactiveTintColor: 'gray',
}}
>
<Tab.Screen
name='home'
component={HomeScreen}
options={{
title: '🎲'
}}
/>
<Tab.Screen
name='rating'
component={RatingScreen}
options={{
title: '🔥'
}}
/>
<Tab.Screen
name='catalog'
component={CatalogScreen}
options={{
title: '📙',
headerShown: false,
}}
/>
<Tab.Screen
name='search'
component={SearchScreen}
options={{
title: '👀'
}}
/>
</Tab.Navigator>
<PostModal
modal={modal}
close={closeModal}
/>
</NavigationContainer>
</PostModalContext.Provider>
);
};