This commit is contained in:
Ammar Ahmed
2021-06-13 14:59:09 +05:00
parent 103f6693e2
commit 6dae813a26

View File

@@ -1,10 +1,9 @@
import React from 'react'; import React from 'react';
import {View} from 'react-native'; import { Platform, View } from 'react-native';
import {Platform} from 'react-native';
import ActionSheet from 'react-native-actions-sheet'; import ActionSheet from 'react-native-actions-sheet';
import { useSafeAreaInsets } from 'react-native-safe-area-context'; import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useTracked } from '../../provider'; import { useTracked } from '../../provider';
import {DDS} from '../../services/DeviceDetection'; import { useSettingStore } from '../../provider/stores';
import { editing } from '../../utils'; import { editing } from '../../utils';
import { hexToRGBA } from '../../utils/ColorUtils'; import { hexToRGBA } from '../../utils/ColorUtils';
import { sleep } from '../../utils/TimeUtils'; import { sleep } from '../../utils/TimeUtils';
@@ -24,23 +23,24 @@ const ActionSheetWrapper = ({
}) => { }) => {
const [state] = useTracked(); const [state] = useTracked();
const {colors} = state; const {colors} = state;
const largeTablet = DDS.isLargeTablet(); const deviceMode = useSettingStore(state => state.deviceMode);
const smallTablet = DDS.isTab; const largeTablet = deviceMode === "tablet"
const smallTablet = deviceMode === "smallTablet"
const insets = useSafeAreaInsets(); const insets = useSafeAreaInsets();
const style = React.useMemo(() => { const style = React.useMemo(() => {
return { return {
width: largeTablet || smallTablet ? 500 : '100%', width: largeTablet || smallTablet ? 500 : '100%',
borderTopRightRadius: 10,
borderTopLeftRadius: 10,
backgroundColor: colors.bg, backgroundColor: colors.bg,
padding: largeTablet ? 8 : 0,
zIndex: 10, zIndex: 10,
paddingVertical: 10, paddingTop:10,
paddingBottom:0,
borderBottomRightRadius: largeTablet ? 10 : 1, borderBottomRightRadius: largeTablet ? 10 : 1,
borderBottomLeftRadius: largeTablet ? 10 : 1, borderBottomLeftRadius: largeTablet ? 10 : 1,
borderTopRightRadius: 10,
borderTopLeftRadius: 10,
marginBottom: largeTablet ? 50 : 0, marginBottom: largeTablet ? 50 : 0,
alignSelf: 'center', alignSelf: 'center',
paddingTop: 10,
}; };
}, [colors.bg, gestureEnabled]); }, [colors.bg, gestureEnabled]);
@@ -92,7 +92,7 @@ const ActionSheetWrapper = ({
} }
onClose={_onClose}> onClose={_onClose}>
{children} {children}
<View style={{height: Platform.OS === 'ios' ? insets.bottom / 2 : 20}} /> <View style={{height: Platform.OS === 'ios' ? insets.bottom / 2 : 0}} />
</ActionSheet> </ActionSheet>
); );
}; };