2018-01-16 18:48:05 +00:00
|
|
|
import React from 'react';
|
|
|
|
import PropTypes from 'prop-types';
|
|
|
|
import { View, TouchableOpacity, Text } from 'react-native';
|
|
|
|
import styles from './styles';
|
|
|
|
|
2018-02-08 14:08:50 +00:00
|
|
|
export default class TabBar extends React.PureComponent {
|
2018-01-16 18:48:05 +00:00
|
|
|
static propTypes = {
|
|
|
|
goToPage: PropTypes.func,
|
|
|
|
activeTab: PropTypes.number,
|
2018-01-30 19:48:26 +00:00
|
|
|
tabs: PropTypes.array,
|
|
|
|
tabEmojiStyle: PropTypes.object
|
2018-01-16 18:48:05 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View style={styles.tabsContainer}>
|
|
|
|
{this.props.tabs.map((tab, i) => (
|
2018-01-30 19:48:26 +00:00
|
|
|
<TouchableOpacity
|
|
|
|
activeOpacity={0.7}
|
|
|
|
key={tab}
|
|
|
|
onPress={() => this.props.goToPage(i)}
|
|
|
|
style={styles.tab}
|
|
|
|
>
|
|
|
|
<Text style={[styles.tabEmoji, this.props.tabEmojiStyle]}>{tab}</Text>
|
2018-01-16 18:48:05 +00:00
|
|
|
{this.props.activeTab === i ? <View style={styles.activeTabLine} /> : <View style={styles.tabLine} />}
|
|
|
|
</TouchableOpacity>
|
|
|
|
))}
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
}
|