|
| 1 | +import * as React from 'react'; |
| 2 | +import { StyleSheet, Text, View } from 'react-native'; |
| 3 | +import { Article } from '../Screens/Article'; |
| 4 | +import { Albums } from '../Screens/Albums'; |
| 5 | +import { Contacts } from '../Screens/Contacts'; |
| 6 | +import { Chat } from '../Screens/Chat'; |
| 7 | +import { createNativeBottomTabNavigator } from '@bottom-tabs/react-navigation'; |
| 8 | + |
| 9 | +const Tab = createNativeBottomTabNavigator(); |
| 10 | + |
| 11 | +function ScreenLayout({ |
| 12 | + children, |
| 13 | + route, |
| 14 | +}: { |
| 15 | + children: React.ReactNode; |
| 16 | + route: { name: string }; |
| 17 | +}) { |
| 18 | + return ( |
| 19 | + <View style={styles.container}> |
| 20 | + <View style={styles.banner}> |
| 21 | + <Text style={styles.bannerTitle}>screenLayout active</Text> |
| 22 | + <Text style={styles.bannerSubtitle}>{route.name}</Text> |
| 23 | + </View> |
| 24 | + <View style={styles.content}>{children}</View> |
| 25 | + </View> |
| 26 | + ); |
| 27 | +} |
| 28 | + |
| 29 | +export default function NativeBottomTabsScreenLayout() { |
| 30 | + return ( |
| 31 | + <Tab.Navigator screenLayout={ScreenLayout}> |
| 32 | + <Tab.Screen |
| 33 | + name="Article" |
| 34 | + component={Article} |
| 35 | + options={{ |
| 36 | + tabBarIcon: () => require('../../assets/icons/article_dark.png'), |
| 37 | + }} |
| 38 | + /> |
| 39 | + <Tab.Screen |
| 40 | + name="Albums" |
| 41 | + component={Albums} |
| 42 | + options={{ |
| 43 | + tabBarIcon: () => require('../../assets/icons/grid_dark.png'), |
| 44 | + }} |
| 45 | + /> |
| 46 | + <Tab.Screen |
| 47 | + name="Contacts" |
| 48 | + component={Contacts} |
| 49 | + options={{ |
| 50 | + tabBarIcon: () => require('../../assets/icons/person_dark.png'), |
| 51 | + }} |
| 52 | + /> |
| 53 | + <Tab.Screen |
| 54 | + name="Chat" |
| 55 | + component={Chat} |
| 56 | + options={{ |
| 57 | + tabBarIcon: () => require('../../assets/icons/chat_dark.png'), |
| 58 | + }} |
| 59 | + /> |
| 60 | + </Tab.Navigator> |
| 61 | + ); |
| 62 | +} |
| 63 | + |
| 64 | +const styles = StyleSheet.create({ |
| 65 | + container: { |
| 66 | + flex: 1, |
| 67 | + backgroundColor: '#F3F0E8', |
| 68 | + }, |
| 69 | + banner: { |
| 70 | + paddingHorizontal: 16, |
| 71 | + paddingVertical: 12, |
| 72 | + backgroundColor: '#1E2D2F', |
| 73 | + }, |
| 74 | + bannerTitle: { |
| 75 | + color: '#F7DBA7', |
| 76 | + fontSize: 12, |
| 77 | + fontWeight: '700', |
| 78 | + textTransform: 'uppercase', |
| 79 | + letterSpacing: 1, |
| 80 | + }, |
| 81 | + bannerSubtitle: { |
| 82 | + marginTop: 4, |
| 83 | + color: '#FFFFFF', |
| 84 | + fontSize: 16, |
| 85 | + fontWeight: '600', |
| 86 | + }, |
| 87 | + content: { |
| 88 | + flex: 1, |
| 89 | + }, |
| 90 | +}); |
0 commit comments