forked from Ivasoft/mattermost-mobile
Force drawer to open to channel menu when new teams are added (#3269)
This commit is contained in:
committed by
Devin Binnie
parent
2bd67deeea
commit
f99d260628
@@ -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;
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user