diff --git a/app/components/channel_drawer/channel_drawer.js b/app/components/channel_drawer/channel_drawer.js index b2c71c2a5..dedf258ef 100644 --- a/app/components/channel_drawer/channel_drawer.js +++ b/app/components/channel_drawer/channel_drawer.js @@ -315,26 +315,37 @@ export default class ChannelDrawer extends PureComponent { openDrawerOffset } = this.state; - const showTeams = openDrawerOffset !== 0 && teamsCount > 1; + const multipleTeams = teamsCount > 1; + const showTeams = openDrawerOffset !== 0 && multipleTeams; if (this.drawerSwiper) { - if (showTeams) { + if (multipleTeams) { this.drawerSwiper.getWrappedInstance().runOnLayout(); } else if (!openDrawerOffset) { this.drawerSwiper.getWrappedInstance().scrollToStart(); } } - const teamsList = ( - - - - ); + const lists = []; + if (multipleTeams) { + const teamsList = ( + + + + ); + lists.push(teamsList); + } - const channelsList = ( - + lists.push( + - {teamsList} - {channelsList} + {lists} ); }; diff --git a/app/components/channel_drawer/drawer_swipper/drawer_swiper.js b/app/components/channel_drawer/drawer_swipper/drawer_swiper.js index b6f26384d..bef5db83d 100644 --- a/app/components/channel_drawer/drawer_swipper/drawer_swiper.js +++ b/app/components/channel_drawer/drawer_swipper/drawer_swiper.js @@ -53,10 +53,12 @@ export default class DrawerSwiper extends PureComponent { theme } = this.props; + const initialPage = React.Children.count(children) - 1; + return ( { if (this.runOnLayout) { if (Platform.OS === 'ios') { - this.scrollView.scrollTo({x: this.offset, animated: false}); + setTimeout(() => { + this.scrollView.scrollTo({x: this.props.width * this.state.index, animated: false}); + }, 100); } else { this.scrollView.setPageWithoutAnimation(this.state.index); }