You've already forked joplin
mirror of
https://github.com/laurent22/joplin.git
synced 2025-11-23 22:36:32 +02:00
Mobile: Add additional checks when updating sidebar state (#12428)
This commit is contained in:
@@ -1243,13 +1243,16 @@ class AppComponent extends React.Component<AppComponentProps, AppComponentState>
|
||||
}
|
||||
}
|
||||
|
||||
private sideMenu_change(isOpen: boolean) {
|
||||
private sideMenu_change = (isOpen: boolean) => {
|
||||
// Make sure showSideMenu property of state is updated
|
||||
// when the menu is open/closed.
|
||||
this.props.dispatch({
|
||||
type: isOpen ? 'SIDE_MENU_OPEN' : 'SIDE_MENU_CLOSE',
|
||||
});
|
||||
}
|
||||
// Avoid dispatching unnecessarily. See https://github.com/laurent22/joplin/issues/12427
|
||||
if (isOpen !== this.props.showSideMenu) {
|
||||
this.props.dispatch({
|
||||
type: isOpen ? 'SIDE_MENU_OPEN' : 'SIDE_MENU_CLOSE',
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
private getSideMenuWidth = () => {
|
||||
const sideMenuWidth = getResponsiveValue({
|
||||
@@ -1339,7 +1342,8 @@ class AppComponent extends React.Component<AppComponentProps, AppComponentState>
|
||||
toleranceY={20}
|
||||
openMenuOffset={this.state.sideMenuWidth}
|
||||
menuPosition={menuPosition}
|
||||
onChange={(isOpen: boolean) => this.sideMenu_change(isOpen)}
|
||||
onChange={this.sideMenu_change}
|
||||
isOpen={this.props.showSideMenu}
|
||||
disableGestures={disableSideMenuGestures}
|
||||
>
|
||||
<StatusBar barStyle={statusBarStyle} />
|
||||
|
||||
Reference in New Issue
Block a user