BottomTabBar.tsx 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. import React from 'react';
  2. import { View, Text, TouchableOpacity, StyleSheet } from 'react-native';
  3. import { FontAwesome } from '@expo/vector-icons';
  4. type TabType = 'search' | 'favorites' | 'settings';
  5. interface BottomTabBarProps {
  6. activeTab: TabType;
  7. onTabChange: (tab: TabType) => void;
  8. }
  9. export default function BottomTabBar({ activeTab, onTabChange }: BottomTabBarProps) {
  10. return (
  11. <View style={styles.tabBar}>
  12. <TouchableOpacity onPress={() => onTabChange('search')} style={styles.tabItem}>
  13. <FontAwesome name="search" size={24} color={activeTab === 'search' ? '#007AFF' : '#666'} />
  14. <Text style={activeTab === 'search' ? styles.activeText : styles.inactiveText}>노래검색</Text>
  15. </TouchableOpacity>
  16. <TouchableOpacity onPress={() => onTabChange('favorites')} style={styles.tabItem}>
  17. <FontAwesome name="star" size={24} color={activeTab === 'favorites' ? '#007AFF' : '#666'} />
  18. <Text style={activeTab === 'favorites' ? styles.activeText : styles.inactiveText}>즐겨찾기</Text>
  19. </TouchableOpacity>
  20. <TouchableOpacity onPress={() => onTabChange('settings')} style={styles.tabItem}>
  21. <FontAwesome name="user" size={24} color={activeTab === 'settings' ? '#007AFF' : '#666'} />
  22. <Text style={activeTab === 'settings' ? styles.activeText : styles.inactiveText}>마이페이지</Text>
  23. </TouchableOpacity>
  24. </View>
  25. );
  26. }
  27. const styles = StyleSheet.create({
  28. tabBar: {
  29. flexDirection: 'row',
  30. justifyContent: 'space-around',
  31. paddingVertical: 12,
  32. paddingBottom: 0,
  33. backgroundColor: '#fff',
  34. borderTopWidth: 0,
  35. },
  36. tabItem: {
  37. alignItems: 'center',
  38. },
  39. activeText: {
  40. fontSize: 12,
  41. color: '#007AFF',
  42. marginTop: 4,
  43. },
  44. inactiveText: {
  45. fontSize: 12,
  46. color: '#666',
  47. marginTop: 4,
  48. },
  49. });