Skip to content

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

fix focus on editor close

ammarahm-ed2667fd226156
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
index f9eb329cd..b4fa90cb5 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
+++ b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
@@ -5,8 +5,9 @@ import {DDS} from '../../services/DeviceDetection';
import {hexToRGBA} from '../../utils/ColorUtils';
import ActionSheet from 'react-native-actions-sheet';
import {GetPremium} from './GetPremium';
-import { editing } from '../../utils';
-import { post } from '../../views/Editor/Functions';
+import {editing} from '../../utils';
+import {EditorWebView, post, textInput} from '../../views/Editor/Functions';
+import {sleep} from '../../utils/TimeUtils';
const ActionSheetWrapper = ({
children,
@@ -39,9 +40,6 @@ const ActionSheetWrapper = ({
};
}, [colors.bg, gestureEnabled]);
-
-
-
return (
<ActionSheet
ref={fwdRef}
@@ -65,21 +63,33 @@ const ActionSheetWrapper = ({
offset={50}
/>
}
- onClose={() => {
- console.log(editing.isFocused,editing.focusType)
+ onClose={async () => {
if (editing.isFocused === true) {
- post('blur');
- if (editing.focusType == "editor") {
- post('focusEditor');
+ if (editing.focusType == 'editor') {
+ await sleep(10);
+ if (Platform.OS === 'android') {
+ textInput.current?.focus();
+ post('focusEditor');
+ EditorWebView.current?.requestFocus();
+ } else {
+ post('focusEditor');
+ }
} else {
- post('focusTitle');
+ await sleep(10);
+ if (Platform.OS === 'android') {
+ textInput.current?.focus();
+ post('focusTitle');
+ EditorWebView.current?.requestFocus();
+ } else {
+ post('focusTitle');
+ }
}
}
if (onClose) {
- onClose()
+ onClose();
}
- } }>
+ }}>
{children}
</ActionSheet>
);