Skip to content

A fully open source & end-to-end encrypted note taking alternative to Evernote.

fix keyboard event

ammarahm-ed2b36c427f02d
diff --git a/apps/mobile/src/navigation/NavigatorStack.js b/apps/mobile/src/navigation/NavigatorStack.js
index 1eeda0de3..c10276c95 100644
--- a/apps/mobile/src/navigation/NavigatorStack.js
+++ b/apps/mobile/src/navigation/NavigatorStack.js
@@ -92,7 +92,7 @@ export const NavigatorStack = React.memo(
const updateRender = async () => {
if (!render) {
setRender(true);
- Navigation.navigate(
+ Navigation.setHeaderState(
SettingsService.get().homepage,
{
menu: true,
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index a45f7c6f5..f6c4e66d8 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -70,12 +70,7 @@ const EditorHeader = () => {
});
}
await clearEditor();
- Keyboard.removeListener('keyboardDidShow', () => {
- if (!editing.movedAway) {
- editing.isFocused = true;
- }
- post('keyboard');
- });
+ Keyboard.removeListener('keyboardDidShow', tiny.onKeyboardShow);
}
};
diff --git a/apps/mobile/src/views/Editor/EditorRoot.js b/apps/mobile/src/views/Editor/EditorRoot.js
index 64f5ca788..eec8645f7 100644
--- a/apps/mobile/src/views/Editor/EditorRoot.js
+++ b/apps/mobile/src/views/Editor/EditorRoot.js
@@ -22,12 +22,14 @@ import {
checkNote,
clearEditor,
clearTimer,
+ EditorWebView,
isNotedEdited,
loadNote,
post,
saveNote,
setIntent,
} from './Functions';
+import tiny, { keyboardStateChanged } from './tiny/tiny';
import {toolbarRef} from './tiny/toolbar/constants';
let handleBack;
@@ -66,12 +68,7 @@ const EditorRoot = () => {
const load = async (item) => {
await loadNote(item);
InteractionManager.runAfterInteractions(() => {
- Keyboard.addListener('keyboardDidShow', () => {
- if (!editing.movedAway) {
- editing.isFocused = true;
- }
- post('keyboard');
- });
+ Keyboard.addListener('keyboardDidShow', tiny.onKeyboardShow);
if (!DDS.isTab) {
handleBack = BackHandler.addEventListener(
'hardwareBackPress',
@@ -141,12 +138,7 @@ const EditorRoot = () => {
});
}
await clearEditor();
- Keyboard.removeListener('keyboardDidShow', () => {
- if (!editing.movedAway) {
- editing.isFocused = true;
- }
- post('keyboard');
- });
+ Keyboard.removeListener('keyboardDidShow', tiny.onKeyboardShow);
if (handleBack) {
handleBack.remove();
handleBack = null;
diff --git a/apps/mobile/src/views/Editor/tiny/tiny.js b/apps/mobile/src/views/Editor/tiny/tiny.js
index 75cfd3e7a..d6c0a42bb 100644
--- a/apps/mobile/src/views/Editor/tiny/tiny.js
+++ b/apps/mobile/src/views/Editor/tiny/tiny.js
@@ -1,4 +1,5 @@
-import { getWebviewInit } from '../Functions';
+import { editing } from '../../../utils';
+import { EditorWebView, getWebviewInit } from '../Functions';
const reset = `
isLoading = true;
@@ -10,7 +11,7 @@ document.activeElement.blur();
window.blur();
`;
-export const keyboardStateChanged = `(() => {
+const keyboardStateChanged = `(() => {
})();
`;
@@ -150,6 +151,14 @@ const clearHistory = `
tinymce.activeEditor.undoManager.clear();
`;
+const onKeyboardShow = () => {
+ if (!editing.movedAway) {
+ editing.isFocused = true;
+ call(EditorWebView,keyboardStateChanged)
+ }
+ }
+
+
export default {
undo,
redo,
@@ -171,5 +180,7 @@ export default {
setTitle,
restoreRange,
isLoading,
- notLoading
+ notLoading,
+ keyboardStateChanged,
+ onKeyboardShow
};