Skip to content

Commit b5f9df7

Browse files
authored
Merge pull request Expensify#87613 from software-mansion-labs/@GCyganek/landscape-mode/avatar-edit-slider
2 parents f9452ff + 94fcff1 commit b5f9df7

1 file changed

Lines changed: 13 additions & 1 deletion

File tree

src/components/AvatarCropModal/AvatarCropModal.tsx

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import PressableWithoutFeedback from '@components/Pressable/PressableWithoutFeed
1515
import ScreenWrapper from '@components/ScreenWrapper';
1616
import Text from '@components/Text';
1717
import Tooltip from '@components/Tooltip';
18+
import useIsInLandscapeMode from '@hooks/useIsInLandscapeMode';
1819
import {useMemoizedLazyExpensifyIcons} from '@hooks/useLazyAsset';
1920
import useLocalize from '@hooks/useLocalize';
2021
import useStyleUtils from '@hooks/useStyleUtils';
@@ -54,12 +55,15 @@ type AvatarCropModalProps = {
5455
buttonLabel?: string;
5556
};
5657

58+
const LANDSCAPE_MODE_SLIDER_CONTAINER_MIN_WIDTH = 300;
59+
5760
// This component can't be written using class since reanimated API uses hooks.
5861
function AvatarCropModal({imageUri = '', imageName = '', imageType = '', onClose, onSave, isVisible, maskImage, buttonLabel}: AvatarCropModalProps) {
5962
const theme = useTheme();
6063
const styles = useThemeStyles();
6164
const StyleUtils = useStyleUtils();
6265
const expensifyIcons = useMemoizedLazyExpensifyIcons(['Rotate', 'Zoom']);
66+
const isInLandscapeMode = useIsInLandscapeMode();
6367

6468
const originalImageWidth = useSharedValue<number>(CONST.AVATAR_CROP_MODAL.INITIAL_SIZE);
6569
const originalImageHeight = useSharedValue<number>(CONST.AVATAR_CROP_MODAL.INITIAL_SIZE);
@@ -407,7 +411,15 @@ function AvatarCropModal({imageUri = '', imageName = '', imageType = '', onClose
407411
rotation={rotation}
408412
maskImage={maskImage}
409413
/>
410-
<View style={[styles.mt5, styles.justifyContentBetween, styles.alignItemsCenter, styles.flexRow, StyleUtils.getWidthStyle(imageContainerSize)]}>
414+
<View
415+
style={[
416+
styles.mt5,
417+
styles.justifyContentBetween,
418+
styles.alignItemsCenter,
419+
styles.flexRow,
420+
StyleUtils.getWidthStyle(isInLandscapeMode ? Math.max(imageContainerSize, LANDSCAPE_MODE_SLIDER_CONTAINER_MIN_WIDTH) : imageContainerSize),
421+
]}
422+
>
411423
<Icon
412424
src={expensifyIcons.Zoom}
413425
fill={theme.icon}

0 commit comments

Comments
 (0)