Force drawer to open to channel menu when new teams are added (#3269)

This commit is contained in:
Mattermost Build
2019-09-18 15:58:44 +02:00
committed by Devin Binnie
parent 2bd67deeea
commit f99d260628
3 changed files with 15 additions and 0 deletions

View File

@@ -52,6 +52,12 @@ export default class DrawerSwiper extends Component {
}
};
scrollToInitial = () => {
if (this.swiperRef?.current) {
this.swiperRef.current.scrollToInitial();
}
}
swiperPageSelected = (index) => {
this.props.onPageSelected(index);
};

View File

@@ -338,6 +338,7 @@ export default class ChannelSidebar extends Component {
if (this.drawerSwiper) {
if (multipleTeams) {
this.drawerSwiper.runOnLayout();
this.drawerSwiper.scrollToInitial();
} else if (!openDrawerOffset) {
this.drawerSwiper.scrollToStart();
}

View File

@@ -107,6 +107,14 @@ export default class Swiper extends PureComponent {
});
};
scrollToInitial = () => {
setTimeout(() => {
if (this.scrollView) {
this.scrollView.scrollTo({x: this.props.width * this.props.initialPage, animated: false});
}
}, 0);
};
refScrollView = (view) => {
this.scrollView = view;
};