[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() { render() {
const { show } = this.state; const { show, frequentlyUsed } = this.state;
const { tabEmojiStyle } = this.props; const { tabEmojiStyle } = this.props;
if (!show) { if (!show) {
@ -155,6 +155,8 @@ export default class EmojiPicker extends Component {
> >
{ {
categories.tabs.map((tab, i) => ( categories.tabs.map((tab, i) => (
(i === 0 && frequentlyUsed.length === 0) ? null // when no frequentlyUsed don't show the tab
: (
<ScrollView <ScrollView
key={tab.category} key={tab.category}
tabLabel={tab.tabLabel} tabLabel={tab.tabLabel}
@ -163,7 +165,7 @@ export default class EmojiPicker extends Component {
> >
{this.renderCategory(tab.category, i)} {this.renderCategory(tab.category, i)}
</ScrollView> </ScrollView>
)) )))
} }
</ScrollableTabView> </ScrollableTabView>
); );