refactor: split app into modular src architecture
This commit is contained in:
28
src/components/BottomTab.js
Normal file
28
src/components/BottomTab.js
Normal file
@@ -0,0 +1,28 @@
|
||||
import React from 'react';
|
||||
import { Pressable, Text, View } from 'react-native';
|
||||
import { styles } from '../styles';
|
||||
|
||||
export default function BottomTab({ current, onChange }) {
|
||||
const tabs = [
|
||||
{ key: 'trips', label: 'Trips' },
|
||||
{ key: 'items', label: 'Items' },
|
||||
{ key: 'checkup', label: 'Check-Up' },
|
||||
{ key: 'history', label: 'History' },
|
||||
];
|
||||
|
||||
return (
|
||||
<View style={styles.tabBarWrap}>
|
||||
<View style={styles.tabBar}>
|
||||
{tabs.map((tab) => {
|
||||
const active = current === tab.key;
|
||||
return (
|
||||
<Pressable key={tab.key} onPress={() => onChange(tab.key)} style={styles.tabItem}>
|
||||
<View style={[styles.tabDot, active && styles.tabDotActive]} />
|
||||
<Text style={[styles.tabLabel, active && styles.tabLabelActive]}>{tab.label}</Text>
|
||||
</Pressable>
|
||||
);
|
||||
})}
|
||||
</View>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user