mirror of
https://github.com/streetwriters/notesnook.git
synced 2025-12-23 23:19:40 +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 ActionSheet from 'react-native-actions-sheet';
|
||||||
import {GetPremium} from './GetPremium';
|
import {GetPremium} from './GetPremium';
|
||||||
import {editing} from '../../utils';
|
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 = ({
|
const ActionSheetWrapper = ({
|
||||||
children,
|
children,
|
||||||
@@ -39,9 +40,6 @@ const ActionSheetWrapper = ({
|
|||||||
};
|
};
|
||||||
}, [colors.bg, gestureEnabled]);
|
}, [colors.bg, gestureEnabled]);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<ActionSheet
|
<ActionSheet
|
||||||
ref={fwdRef}
|
ref={fwdRef}
|
||||||
@@ -65,19 +63,31 @@ const ActionSheetWrapper = ({
|
|||||||
offset={50}
|
offset={50}
|
||||||
/>
|
/>
|
||||||
}
|
}
|
||||||
onClose={() => {
|
onClose={async () => {
|
||||||
console.log(editing.isFocused,editing.focusType)
|
|
||||||
if (editing.isFocused === true) {
|
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');
|
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 {
|
} else {
|
||||||
post('focusTitle');
|
post('focusTitle');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (onClose) {
|
if (onClose) {
|
||||||
onClose()
|
onClose();
|
||||||
}
|
}
|
||||||
}}>
|
}}>
|
||||||
{children}
|
{children}
|
||||||
|
|||||||
Reference in New Issue
Block a user