mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
fix editor focus after closing actionsheet
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user