RN-462 Allow user and channel lists to load more than one additional page of content (#1305)

* RN-462 Allow user lists to load more than one additional page of users

* RN-462 Actually load more users for direct messages list

* Allow loading more than one page in the More Channels modal
This commit is contained in:
Harrison Healey 2017-12-21 07:03:17 -05:00 committed by enahum
parent 2ad5dd9e26
commit 16e293ffab
4 changed files with 6 additions and 4 deletions

View file

@ -184,7 +184,7 @@ class ChannelAddMembers extends PureComponent {
let {page} = this.state;
if (loadMoreRequestStatus !== RequestStatus.STARTED && next && !searching) {
page = page + 1;
actions.getProfilesNotInChannel(currentTeam.id, currentChannel.id, page, General.PROFILE_CHUNK_SIZE).then((data) => {
actions.getProfilesNotInChannel(currentTeam.id, currentChannel.id, page, General.PROFILE_CHUNK_SIZE).then(({data}) => {
if (data && data.length) {
this.setState({
page

View file

@ -212,7 +212,7 @@ class ChannelMembers extends PureComponent {
if (requestStatus !== RequestStatus.STARTED && next && !searching) {
page = page + 1;
actions.getProfilesInChannel(currentChannel.id, page, General.PROFILE_CHUNK_SIZE).then(
(data) => {
({data}) => {
if (data && data.length) {
this.setState({
page

View file

@ -181,7 +181,7 @@ class MoreChannels extends PureComponent {
this.props.currentTeamId,
page,
General.CHANNELS_CHUNK_SIZE
).then((data) => {
).then(({data}) => {
if (data && data.length) {
this.setState({
page

View file

@ -195,7 +195,7 @@ class MoreDirectMessages extends PureComponent {
let {page} = this.state;
if (this.props.getRequest.status !== RequestStatus.STARTED && this.state.next && !this.state.searching) {
page = page + 1;
this.getProfiles(page).then((data) => {
this.getProfiles(page).then(({data}) => {
if (data && data.length) {
this.setState({
page
@ -420,6 +420,8 @@ class MoreDirectMessages extends PureComponent {
sectionKeyExtractor={this.sectionKeyExtractor}
compareItems={this.compareItems}
extraData={this.state.selectedIds}
onListEndReached={this.loadMoreProfiles}
listScrollRenderAheadDistance={50}
onRowPress={this.handleSelectUser}
loading={isLoading}
loadingText={loadingText}