mirror of
https://github.com/laurent22/joplin.git
synced 2024-12-18 09:35:20 +02:00
25 lines
512 B
TypeScript
25 lines
512 B
TypeScript
const { BackButtonService } = require('lib/services/back-button.js');
|
|
const DialogBox = require('react-native-dialogbox').default;
|
|
|
|
export default class BackButtonDialogBox extends DialogBox {
|
|
constructor() {
|
|
super();
|
|
|
|
this.backHandler_ = () => {
|
|
if (this.state.isVisible) {
|
|
this.close();
|
|
return true;
|
|
}
|
|
return false;
|
|
};
|
|
}
|
|
|
|
componentDidMount() {
|
|
BackButtonService.addHandler(this.backHandler_);
|
|
}
|
|
|
|
componentWillUnmount() {
|
|
BackButtonService.removeHandler(this.backHandler_);
|
|
}
|
|
}
|