Skip to content

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

fix editing.isFocused set to true outside editor

ammarahm-ed36f2bc4f9e7f
diff --git a/apps/mobile/initializer.root.js b/apps/mobile/initializer.root.js
index 2ac8b04c9..86dfa8f55 100644
--- a/apps/mobile/initializer.root.js
+++ b/apps/mobile/initializer.root.js
@@ -35,7 +35,6 @@ import {editorRef, tabBarRef} from './src/utils/Refs';
import {EditorWrapper} from './src/views/Editor/EditorWrapper';
import {getIntent, getNote, post} from './src/views/Editor/Functions';
let {width, height} = Dimensions.get('window');
-let movedAway = true;
let layoutTimer = null;
let currentTab = 0;
@@ -43,7 +42,7 @@ let currentTab = 0;
const onChangeTab = async (obj) => {
if (obj.i === 1) {
eSendEvent(eCloseSideMenu);
- movedAway = false;
+ editing.movedAway = false;
currentTab = 1;
activateKeepAwake();
eSendEvent('navigate');
@@ -58,7 +57,7 @@ const onChangeTab = async (obj) => {
if (getNote()?.locked) {
eSendEvent(eClearEditor);
}
- movedAway = true;
+ editing.movedAway = true;
post('blur');
}
editing.isFocused = false;
@@ -227,7 +226,7 @@ const AppStack = React.memo(
paddingHorizontal: 0,
},
});
- if (!movedAway && current !== 'tablet') {
+ if (!editing.movedAway && current !== 'tablet') {
tabBarRef.current?.goToPage(1);
}
}
diff --git a/apps/mobile/src/utils/index.js b/apps/mobile/src/utils/index.js
index 223e39c9e..b781147b9 100755
--- a/apps/mobile/src/utils/index.js
+++ b/apps/mobile/src/utils/index.js
@@ -57,7 +57,8 @@ export const editing = {
type: null,
},
isFocused:false,
- focusType:null
+ focusType:null,
+ movedAway:true
};
export const selection = {
data: [],
diff --git a/apps/mobile/src/views/Editor/EditorHeader.js b/apps/mobile/src/views/Editor/EditorHeader.js
index e10a9f99a..de5685783 100644
--- a/apps/mobile/src/views/Editor/EditorHeader.js
+++ b/apps/mobile/src/views/Editor/EditorHeader.js
@@ -91,7 +91,9 @@ const EditorHeader = () => {
}
await clearEditor();
Keyboard.removeListener('keyboardDidShow', () => {
- editing.isFocused = true;
+ if (!editing.movedAway) {
+ editing.isFocused = true;
+ }
post('keyboard');
});
if (handleBack) {
diff --git a/apps/mobile/src/views/Editor/EditorRoot.js b/apps/mobile/src/views/Editor/EditorRoot.js
index 8c260b8b9..8b139c423 100644
--- a/apps/mobile/src/views/Editor/EditorRoot.js
+++ b/apps/mobile/src/views/Editor/EditorRoot.js
@@ -3,7 +3,7 @@ import {BackHandler, InteractionManager, Keyboard} from 'react-native';
import RNExitApp from 'react-native-exit-app';
import {simpleDialogEvent} from '../../components/DialogManager/recievers';
import {TEMPLATE_EXIT_FULLSCREEN} from '../../components/DialogManager/Templates';
-import { useTracked } from '../../provider';
+import {useTracked} from '../../provider';
import {DDS} from '../../services/DeviceDetection';
import {
eSendEvent,
@@ -66,7 +66,10 @@ const EditorRoot = () => {
await loadNote(item);
InteractionManager.runAfterInteractions(() => {
Keyboard.addListener('keyboardDidShow', () => {
- editing.isFocused = true;
+ console.log(editing.currentlyEditing,'current')
+ if (!editing.movedAway) {
+ editing.isFocused = true;
+ }
post('keyboard');
});
if (!DDS.isTab) {
@@ -128,7 +131,9 @@ const EditorRoot = () => {
}
await clearEditor();
Keyboard.removeListener('keyboardDidShow', () => {
- editing.isFocused = true;
+ if (!editing.movedAway) {
+ editing.isFocused = true;
+ }
post('keyboard');
});
if (handleBack) {