From c20a01a0a2e08954994ceafaee6d1269bd1615bc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Odziemczyk?= Date: Wed, 14 Mar 2018 15:30:27 +0100 Subject: [PATCH] Fix missing code from "delay post list for animation frame" (#1497) * Fix missing code from "delay post list for animation frame" * fix * move setState elsewhere * update * fix * eslint * remove some diff --- .../channel/channel_post_list/channel_post_list.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/screens/channel/channel_post_list/channel_post_list.js b/app/screens/channel/channel_post_list/channel_post_list.js index 832ce5690..15e730558 100644 --- a/app/screens/channel/channel_post_list/channel_post_list.js +++ b/app/screens/channel/channel_post_list/channel_post_list.js @@ -54,6 +54,7 @@ export default class ChannelPostList extends PureComponent { const {postIds: nextPostIds} = nextProps; let visiblePostIds = this.state.visiblePostIds; + const channelSwitch = nextProps.channelId !== this.props.channelId; if (nextPostIds !== this.props.postIds || nextProps.postVisibility !== this.props.postVisibility) { visiblePostIds = this.getVisiblePostIds(nextProps); @@ -61,7 +62,12 @@ export default class ChannelPostList extends PureComponent { this.setState({ visiblePostIds, - }); + loading: channelSwitch, + }, () => InteractionManager.runAfterInteractions(() => { + if (channelSwitch) { + this.setState({loading: false}); + } + })); } componentDidUpdate(prevProps) {