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

37 lines
919 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={() => {
if (goToPage) {
goToPage(i);
}
}}
style={styles.tab}
testID={`reaction-picker-${tab}`}>
<Text style={[styles.tabEmoji, tabEmojiStyle]}>{tab}</Text>
{activeTab === i ? (
<View style={[styles.activeTabLine, { backgroundColor: colors.tintColor }]} />
) : (
<View style={styles.tabLine} />
)}
</TouchableOpacity>
))}
</View>
);
});
2022-06-23 19:52:53 +00:00
export default TabBar;