mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 06:59:31 +01:00
fix focus on editor close
This commit is contained in:
@@ -6,7 +6,8 @@ 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 {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,19 +63,31 @@ const ActionSheetWrapper = ({
|
||||
offset={50}
|
||||
/>
|
||||
}
|
||||
onClose={() => {
|
||||
console.log(editing.isFocused,editing.focusType)
|
||||
onClose={async () => {
|
||||
if (editing.isFocused === true) {
|
||||
post('blur');
|
||||
if (editing.focusType == "editor") {
|
||||
if (editing.focusType == 'editor') {
|
||||
await sleep(10);
|
||||
if (Platform.OS === 'android') {
|
||||
textInput.current?.focus();
|
||||
post('focusEditor');
|
||||
EditorWebView.current?.requestFocus();
|
||||
} else {
|
||||
post('focusEditor');
|
||||
}
|
||||
} else {
|
||||
await sleep(10);
|
||||
if (Platform.OS === 'android') {
|
||||
textInput.current?.focus();
|
||||
post('focusTitle');
|
||||
EditorWebView.current?.requestFocus();
|
||||
} else {
|
||||
post('focusTitle');
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (onClose) {
|
||||
onClose()
|
||||
onClose();
|
||||
}
|
||||
}}>
|
||||
{children}
|
||||
|
||||
Reference in New Issue
Block a user