[IMPROVEMENT] Hide frequently used emoji tab when empty (#792)

This commit is contained in:
IlarionHalushka 2019-06-27 19:16:05 +03:00 committed by Diego Mello
parent 636518b6b3
commit fc264f0601
1 changed files with 12 additions and 10 deletions

View File

@ -141,7 +141,7 @@ export default class EmojiPicker extends Component {
}
render() {
const { show } = this.state;
const { show, frequentlyUsed } = this.state;
const { tabEmojiStyle } = this.props;
if (!show) {
@ -155,15 +155,17 @@ export default class EmojiPicker extends Component {
>
{
categories.tabs.map((tab, i) => (
<ScrollView
key={tab.category}
tabLabel={tab.tabLabel}
style={styles.background}
{...scrollProps}
>
{this.renderCategory(tab.category, i)}
</ScrollView>
))
(i === 0 && frequentlyUsed.length === 0) ? null // when no frequentlyUsed don't show the tab
: (
<ScrollView
key={tab.category}
tabLabel={tab.tabLabel}
style={styles.background}
{...scrollProps}
>
{this.renderCategory(tab.category, i)}
</ScrollView>
)))
}
</ScrollableTabView>
);