This commit is contained in:
ammarahm-ed
2021-02-15 11:02:09 +05:00
parent 91639874ed
commit c69288d597

View File

@@ -1,4 +1,4 @@
import React from 'react'; import React, {useEffect} from 'react';
import {Platform} from 'react-native'; import {Platform} from 'react-native';
import {useTracked} from '../../provider'; import {useTracked} from '../../provider';
import {DDS} from '../../services/DeviceDetection'; import {DDS} from '../../services/DeviceDetection';
@@ -15,6 +15,7 @@ import {
import {sleep} from '../../utils/TimeUtils'; import {sleep} from '../../utils/TimeUtils';
import tiny from '../../views/Editor/tiny/tiny'; import tiny from '../../views/Editor/tiny/tiny';
import {focusEditor} from '../../views/Editor/tiny/toolbar/constants'; import {focusEditor} from '../../views/Editor/tiny/toolbar/constants';
import {changeAppScale} from '../../utils/Animations';
const ActionSheetWrapper = ({ const ActionSheetWrapper = ({
children, children,
@@ -47,6 +48,28 @@ const ActionSheetWrapper = ({
}; };
}, [colors.bg, gestureEnabled]); }, [colors.bg, gestureEnabled]);
const _onOpen = () => {
//changeAppScale(0.975, 150);
onOpen && onOpen();
};
const _onClose = async () => {
//changeAppScale(1, 150);
if (editing.isFocused === true) {
textInput.current?.focus();
await sleep(10);
if (editing.focusType == 'editor') {
focusEditor();
} else {
Platform.OS === 'android' && EditorWebView.current.requestFocus();
tiny.call(EditorWebView, tiny.focusTitle);
}
}
if (onClose) {
onClose();
}
};
return ( return (
<ActionSheet <ActionSheet
ref={fwdRef} ref={fwdRef}
@@ -61,7 +84,7 @@ const ActionSheetWrapper = ({
? hexToRGBA(colors.accent + '19') ? hexToRGBA(colors.accent + '19')
: hexToRGBA(colors.shade) : hexToRGBA(colors.shade)
} }
onOpen={onOpen} onOpen={_onOpen}
keyboardShouldPersistTaps="always" keyboardShouldPersistTaps="always"
premium={ premium={
<GetPremium <GetPremium
@@ -70,21 +93,7 @@ const ActionSheetWrapper = ({
offset={50} offset={50}
/> />
} }
onClose={async () => { onClose={_onClose}>
if (editing.isFocused === true) {
textInput.current?.focus();
await sleep(10);
if (editing.focusType == 'editor') {
focusEditor();
} else {
Platform.OS === 'android' && EditorWebView.current.requestFocus();
tiny.call(EditorWebView, tiny.focusTitle);
}
}
if (onClose) {
onClose();
}
}}>
{children} {children}
</ActionSheet> </ActionSheet>
); );