Refactor frontend-mobile
This commit is contained in:
@@ -1,14 +1,40 @@
|
||||
import { Tabs } from 'expo-router';
|
||||
import { Ionicons } from '@expo/vector-icons';
|
||||
import { View, StyleSheet, Platform } from 'react-native';
|
||||
import { colors, shadows } from '../../constants/theme';
|
||||
|
||||
function ScanIcon({ color, size }: { color: string; size: number }) {
|
||||
return (
|
||||
<View style={styles.fabContainer}>
|
||||
<View style={[styles.fab, shadows.scanButton]}>
|
||||
<Ionicons name="scan" size={size} color="#ffffff" />
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
export default function TabLayout() {
|
||||
return (
|
||||
<Tabs
|
||||
screenOptions={{
|
||||
tabBarActiveTintColor: '#007AFF',
|
||||
tabBarInactiveTintColor: '#8E8E93',
|
||||
tabBarActiveTintColor: colors.primary,
|
||||
tabBarInactiveTintColor: colors.textSecondary,
|
||||
tabBarStyle: styles.tabBar,
|
||||
tabBarLabelStyle: styles.tabBarLabel,
|
||||
headerStyle: styles.header,
|
||||
headerTintColor: colors.primary,
|
||||
headerTitleStyle: styles.headerTitle,
|
||||
}}
|
||||
>
|
||||
<Tabs.Screen
|
||||
name="home"
|
||||
options={{
|
||||
title: 'Inicio',
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="home" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="index"
|
||||
options={{
|
||||
@@ -18,13 +44,27 @@ export default function TabLayout() {
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="scan"
|
||||
options={{
|
||||
title: 'Escanear',
|
||||
tabBarIcon: ({ color, size }) => <ScanIcon color={color} size={size} />,
|
||||
tabBarLabel: () => null,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="alerts"
|
||||
options={{
|
||||
title: 'Avisos',
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="notifications" size={size} color={color} />
|
||||
),
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
name="map"
|
||||
options={{
|
||||
title: 'Mapa',
|
||||
tabBarIcon: ({ color, size }) => (
|
||||
<Ionicons name="map" size={size} color={color} />
|
||||
),
|
||||
href: null,
|
||||
}}
|
||||
/>
|
||||
<Tabs.Screen
|
||||
@@ -39,3 +79,43 @@ export default function TabLayout() {
|
||||
</Tabs>
|
||||
);
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
tabBar: {
|
||||
backgroundColor: colors.card,
|
||||
borderTopColor: colors.border,
|
||||
height: Platform.OS === 'ios' ? 88 : 64,
|
||||
paddingBottom: Platform.OS === 'ios' ? 24 : 8,
|
||||
paddingTop: 8,
|
||||
},
|
||||
tabBarLabel: {
|
||||
fontSize: 11,
|
||||
fontWeight: '500',
|
||||
},
|
||||
header: {
|
||||
backgroundColor: colors.card,
|
||||
shadowColor: '#000',
|
||||
shadowOffset: { width: 0, height: 1 },
|
||||
shadowOpacity: 0.05,
|
||||
shadowRadius: 4,
|
||||
elevation: 1,
|
||||
},
|
||||
headerTitle: {
|
||||
color: colors.text,
|
||||
fontWeight: '600',
|
||||
fontSize: 17,
|
||||
},
|
||||
fabContainer: {
|
||||
position: 'absolute',
|
||||
top: -16,
|
||||
alignItems: 'center',
|
||||
},
|
||||
fab: {
|
||||
width: 52,
|
||||
height: 52,
|
||||
borderRadius: 26,
|
||||
backgroundColor: colors.scanButton,
|
||||
alignItems: 'center',
|
||||
justifyContent: 'center',
|
||||
},
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user