1
0
mirror of https://github.com/laurent22/joplin.git synced 2025-06-15 23:00:36 +02:00

Improved back button handling when note has been modified

This commit is contained in:
Laurent Cozic
2017-08-24 18:10:03 +00:00
parent d9c85a7275
commit 7aaf4fb491
6 changed files with 106 additions and 26 deletions

View File

@ -1,6 +1,7 @@
import React, { Component } from 'react';
import { BackHandler, Keyboard, NativeModules } from 'react-native';
import { Keyboard, NativeModules } from 'react-native';
import { connect, Provider } from 'react-redux'
import { BackButtonService } from 'lib/services/back-button.js';
import { createStore, applyMiddleware } from 'redux';
import { shimInit } from 'lib/shim-init-react.js';
import { Log } from 'lib/log.js'
@ -497,9 +498,7 @@ async function initialize(dispatch, backButtonHandler) {
reg.logger().error('Initialization error:', error);
}
BackHandler.addEventListener('hardwareBackPress', () => {
return backButtonHandler();
});
BackButtonService.initialize(backButtonHandler);
reg.setupRecurrentSync();
@ -535,7 +534,7 @@ class AppComponent extends React.Component {
}
}
backButtonHandler() {
async backButtonHandler() {
if (this.props.showSideMenu) {
this.props.dispatch({ type: 'SIDE_MENU_CLOSE' });
return true;