update ActionSheet

This commit is contained in:
ammarahm-ed
2021-07-10 14:23:30 +05:00
parent e497bbf98f
commit 398a56a5d2
3 changed files with 27 additions and 25 deletions

View File

@@ -1,17 +1,17 @@
import React from 'react';
import { Platform, View } from 'react-native';
import {Platform, View} from 'react-native';
import ActionSheet from 'react-native-actions-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTracked } from '../../provider';
import { useSettingStore } from '../../provider/stores';
import { editing } from '../../utils';
import { hexToRGBA } from '../../utils/ColorUtils';
import { sleep } from '../../utils/TimeUtils';
import { EditorWebView, textInput } from '../../views/Editor/Functions';
import {useSafeAreaInsets} from 'react-native-safe-area-context';
import {useTracked} from '../../provider';
import {useSettingStore} from '../../provider/stores';
import {editing} from '../../utils';
import {hexToRGBA} from '../../utils/ColorUtils';
import {sleep} from '../../utils/TimeUtils';
import {EditorWebView, textInput} from '../../views/Editor/Functions';
import tiny from '../../views/Editor/tiny/tiny';
import { focusEditor } from '../../views/Editor/tiny/toolbar/constants';
import { Toast } from '../Toast';
import { GetPremium } from './GetPremium';
import {focusEditor} from '../../views/Editor/tiny/toolbar/constants';
import {Toast} from '../Toast';
import {GetPremium} from './GetPremium';
const ActionSheetWrapper = ({
children,
@@ -20,22 +20,23 @@ const ActionSheetWrapper = ({
onClose,
onOpen,
closeOnTouchBackdrop = true,
onHasReachedTop
onHasReachedTop,
keyboardMode,
}) => {
const [state] = useTracked();
const {colors} = state;
const deviceMode = useSettingStore(state => state.deviceMode);
const largeTablet = deviceMode === "tablet"
const smallTablet = deviceMode === "smallTablet"
const largeTablet = deviceMode === 'tablet';
const smallTablet = deviceMode === 'smallTablet';
const insets = useSafeAreaInsets();
const style = React.useMemo(() => {
return {
width: largeTablet || smallTablet ? 500 : '100%',
backgroundColor: colors.bg,
zIndex: 10,
paddingTop:10,
paddingBottom:0,
paddingTop: 10,
paddingBottom: 0,
borderBottomRightRadius: largeTablet ? 10 : 1,
borderBottomLeftRadius: largeTablet ? 10 : 1,
borderTopRightRadius: 10,
@@ -75,6 +76,8 @@ const ActionSheetWrapper = ({
initialOffsetFromBottom={1}
onPositionChanged={onHasReachedTop}
closeOnTouchBackdrop={closeOnTouchBackdrop}
keyboardMode={keyboardMode}
closeOnPressBack={closeOnTouchBackdrop}
indicatorColor={
Platform.OS === 'ios'
? hexToRGBA(colors.accent + '19')
@@ -94,7 +97,7 @@ const ActionSheetWrapper = ({
}
onClose={_onClose}>
{children}
<View style={{height: Platform.OS === 'ios' ? insets.bottom / 2 :0}} />
<View style={{height: Platform.OS === 'ios' ? insets.bottom / 2 : 0}} />
</ActionSheet>
);
};