1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-03-29 21:21:15 +02:00

Mobile: Resolves : Handle back button when sort popup is open ()

This commit is contained in:
roman-r-m 2020-05-14 16:03:13 +01:00 committed by GitHub
parent b5fc8e7fc1
commit 7d767cf0c9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -15,6 +15,7 @@ const { ActionButton } = require('lib/components/action-button.js');
const { dialogs } = require('lib/dialogs.js');
const DialogBox = require('react-native-dialogbox').default;
const { BaseScreenComponent } = require('lib/components/base-screen.js');
const { BackButtonService } = require('lib/services/back-button.js');
class NotesScreenComponent extends BaseScreenComponent {
static navigationOptions() {
@ -68,6 +69,14 @@ class NotesScreenComponent extends BaseScreenComponent {
Setting.setValue(r.name, r.value);
};
this.backHandler = () => {
if (this.dialogbox.state.isVisible) {
this.dialogbox.close();
return true;
}
return false;
};
}
styles() {
@ -91,10 +100,12 @@ class NotesScreenComponent extends BaseScreenComponent {
async componentDidMount() {
await this.refreshNotes();
AppState.addEventListener('change', this.onAppStateChange_);
BackButtonService.addHandler(this.backHandler);
}
async componentWillUnmount() {
AppState.removeEventListener('change', this.onAppStateChange_);
BackButtonService.removeHandler(this.backHandler);
}
async componentDidUpdate(prevProps) {