Skip to content

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

fix editor focus after closing actionsheet

ammarahm-ed57f6c7a3907c
diff --git a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
index b4fa90cb5..01c6c4d43 100644
--- a/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
+++ b/apps/mobile/src/components/ActionSheetComponent/ActionSheetWrapper.js
@@ -6,8 +6,15 @@ import {hexToRGBA} from '../../utils/ColorUtils';
import ActionSheet from 'react-native-actions-sheet';
import {GetPremium} from './GetPremium';
import {editing} from '../../utils';
-import {EditorWebView, post, textInput} from '../../views/Editor/Functions';
+import {
+ editorTitleInput,
+ EditorWebView,
+ post,
+ textInput,
+} from '../../views/Editor/Functions';
import {sleep} from '../../utils/TimeUtils';
+import tiny from '../../views/Editor/tiny/tiny';
+import {focusEditor} from '../../views/Editor/tiny/toolbar/constants';
const ActionSheetWrapper = ({
children,
@@ -65,27 +72,15 @@ const ActionSheetWrapper = ({
}
onClose={async () => {
if (editing.isFocused === true) {
+ textInput.current?.focus();
+ await sleep(10);
if (editing.focusType == 'editor') {
- await sleep(10);
- if (Platform.OS === 'android') {
- textInput.current?.focus();
- post('focusEditor');
- EditorWebView.current?.requestFocus();
- } else {
- post('focusEditor');
- }
+ focusEditor();
} else {
- await sleep(10);
- if (Platform.OS === 'android') {
- textInput.current?.focus();
- post('focusTitle');
- EditorWebView.current?.requestFocus();
- } else {
- post('focusTitle');
- }
+ Platform.OS === 'android' && EditorWebView.current.requestFocus();
+ tiny.call(EditorWebView, tiny.focusTitle);
}
}
-
if (onClose) {
onClose();
}
diff --git a/apps/mobile/src/components/ActionSheetComponent/GetPremium.js b/apps/mobile/src/components/ActionSheetComponent/GetPremium.js
index 3796a51b2..f68c3f620 100644
--- a/apps/mobile/src/components/ActionSheetComponent/GetPremium.js
+++ b/apps/mobile/src/components/ActionSheetComponent/GetPremium.js
@@ -17,7 +17,8 @@ import {
} from '../../utils/Events';
import {SIZE} from '../../utils/SizeUtils';
import {sleep} from '../../utils/TimeUtils';
-import {post} from '../../views/Editor/Functions';
+import {EditorWebView, post} from '../../views/Editor/Functions';
+import tiny from '../../views/Editor/tiny/tiny';
import {Button} from '../Button';
import Heading from '../Typography/Heading';
import Paragraph from '../Typography/Paragraph';
@@ -99,7 +100,7 @@ export const GetPremium = ({close, context = 'global', offset = 0}) => {
open(null);
eSendEvent(eCloseActionSheet);
if (editing.isFocused) {
- post('blur');
+ tiny.call(EditorWebView,tiny.blur)
}
await sleep(300);
eSendEvent(eOpenPremiumDialog);