verdnatura-chat/app/containers/EmojiPicker/TabBar.tsx

29 lines
825 B
TypeScript
Raw Normal View History

import React from 'react';
import { Text, TouchableOpacity, View } from 'react-native';
import styles from './styles';
2022-06-23 19:52:53 +00:00
import { useTheme } from '../../theme';
import { ITabBarProps } from './interfaces';
2022-06-23 19:52:53 +00:00
const TabBar = React.memo(({ activeTab, tabs, goToPage, tabEmojiStyle }: ITabBarProps) => {
const { colors } = useTheme();
2022-06-23 19:52:53 +00:00
return (
<View style={styles.tabsContainer}>
{tabs?.map((tab, i) => (
<TouchableOpacity
activeOpacity={0.7}
key={tab}
onPress={() => goToPage?.(i)}
2022-06-23 19:52:53 +00:00
style={styles.tab}
testID={`reaction-picker-${tab}`}>
<Text style={[styles.tabEmoji, tabEmojiStyle]}>{tab}</Text>
<View style={activeTab === i ? [styles.activeTabLine, { backgroundColor: colors.tintColor }] : styles.tabLine} />
2022-06-23 19:52:53 +00:00
</TouchableOpacity>
))}
</View>
);
});
2022-06-23 19:52:53 +00:00
export default TabBar;