[MM-18550] Force drawer to open to channel menu when new teams are added (#3266)
This commit is contained in:
parent
e9db272a9e
commit
0db54cd3c2
3 changed files with 15 additions and 0 deletions
|
|
@ -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);
|
||||
};
|
||||
|
|
|
|||
|
|
@ -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();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
};
|
||||
|
|
|
|||
Loading…
Reference in a new issue