Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: check if image is rotated before cropping #40971

Merged
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 11 additions & 4 deletions src/components/AvatarCropModal/AvatarCropModal.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -119,10 +119,17 @@ function AvatarCropModal({imageUri = '', imageName = '', imageType = '', onClose
if (!imageUri) {
return;
}
ImageSize.getSize(imageUri).then(({width, height}) => {
// We need to have image sizes in shared values to properly calculate position/size/animation
originalImageHeight.value = height;
originalImageWidth.value = width;
// We need to have image sizes in shared values to properly calculate position/size/animation
ImageSize.getSize(imageUri).then(({width, height, rotation: orginalRotation}) => {
// On Android devices ImageSize library returns also rotation parameter.
if (orginalRotation === 90 || orginalRotation === 270) {
originalImageHeight.value = width;
originalImageWidth.value = height;
} else {
originalImageHeight.value = height;
originalImageWidth.value = width;
}

setIsImageInitialized(true);

// Because the reanimated library has some internal optimizations,
Expand Down
Loading