From f23546ef5e07fbe56f9eca419578742a13fe58c3 Mon Sep 17 00:00:00 2001 From: Sudheer Date: Sat, 30 Jun 2018 02:04:23 +0530 Subject: [PATCH] MM-11035 Add missing loading screen when the Add Members to channel screen is loading (#1853) * Add showNoResults state to custom_list --- .../channel_add_members/channel_add_members.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/app/screens/channel_add_members/channel_add_members.js b/app/screens/channel_add_members/channel_add_members.js index 42ebb9cde..64e5a2bcb 100644 --- a/app/screens/channel_add_members/channel_add_members.js +++ b/app/screens/channel_add_members/channel_add_members.js @@ -63,6 +63,7 @@ class ChannelAddMembers extends PureComponent { selectedMembers: {}, showNoResults: false, term: '', + isLoading: true, }; this.addButton.title = props.intl.formatMessage({id: 'integrations.add', defaultMessage: 'Add'}); @@ -123,6 +124,12 @@ class ChannelAddMembers extends PureComponent { break; } } + + if ((loadMoreRequestStatus !== nextProps.loadMoreRequestStatus) || (this.props.searchRequestStatus !== nextProps.searchRequestStatus)) { + const isLoading = (nextProps.loadMoreRequestStatus === RequestStatus.STARTED) || + (nextProps.searchRequestStatus === RequestStatus.STARTED); + this.setState({isLoading}); + } } cancelSearch = () => { @@ -222,11 +229,9 @@ class ChannelAddMembers extends PureComponent { }; render() { - const {intl, loadMoreRequestStatus, searchRequestStatus, preferences, theme} = this.props; + const {intl, preferences, theme} = this.props; const {adding, profiles, searching, term} = this.state; const {formatMessage} = intl; - const isLoading = (loadMoreRequestStatus === RequestStatus.STARTED) || - (searchRequestStatus === RequestStatus.STARTED); const style = getStyleFromTheme(theme); const more = searching ? () => true : this.loadMoreMembers; @@ -281,12 +286,13 @@ class ChannelAddMembers extends PureComponent { onListEndReached={more} preferences={preferences} listScrollRenderAheadDistance={50} - loading={isLoading} + loading={this.state.isLoading} loadingText={loadingText} selectable={this.state.canSelect} onRowSelect={this.handleRowSelect} renderRow={UserListRow} createSections={createMembersSections} + showNoResults={this.state.showNoResults} /> );