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