From 17da7ac09cbabdec080104f455c60609c0d94059 Mon Sep 17 00:00:00 2001 From: Diego Mello Date: Thu, 6 Dec 2018 10:53:20 -0200 Subject: [PATCH] Chats: Don't show group header if none of the filters is selected (#560) --- app/views/RoomsListView/index.js | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/app/views/RoomsListView/index.js b/app/views/RoomsListView/index.js index b531a00e..4cdb2060 100644 --- a/app/views/RoomsListView/index.js +++ b/app/views/RoomsListView/index.js @@ -502,7 +502,19 @@ export default class RoomsListView extends LoggedView { ); } - renderSeparator = () => ; + renderSeparator = () => + + renderSectionHeader = (header) => { + const { showUnread, showFavorites, groupByType } = this.props; + if (!(showUnread || showFavorites || groupByType)) { + return null; + } + return ( + + {I18n.t(header)} + + ); + } renderSection = (data, header) => { const { showUnread, showFavorites, groupByType } = this.props; @@ -525,11 +537,7 @@ export default class RoomsListView extends LoggedView { style={styles.list} renderItem={this.renderItem} ItemSeparatorComponent={this.renderSeparator} - ListHeaderComponent={() => ( - - {I18n.t(header)} - - )} + ListHeaderComponent={() => this.renderSectionHeader(header)} getItemLayout={getItemLayout} enableEmptySections removeClippedSubviews