From fa5efd40074e02c6b7b7db28b89a3723322df2e1 Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Thu, 4 Oct 2018 19:41:41 -0300 Subject: [PATCH] Revert "image thumbnail not centered (#2210)" and fix it properly (#2219) This reverts commit 5f31374e746531c77233d965ea48d0c7ef05edc5. --- .../file_attachment_list/file_attachment_image.js | 15 +++++++++------ .../file_upload_item/file_upload_item.js | 3 +++ 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/app/components/file_attachment_list/file_attachment_image.js b/app/components/file_attachment_list/file_attachment_image.js index ab711e7ea..e087447da 100644 --- a/app/components/file_attachment_list/file_attachment_image.js +++ b/app/components/file_attachment_list/file_attachment_image.js @@ -37,6 +37,8 @@ export default class FileAttachmentImage extends PureComponent { onCaptureRef: PropTypes.func, resizeMode: PropTypes.string, resizeMethod: PropTypes.string, + wrapperHeight: PropTypes.number, + wrapperWidth: PropTypes.number, }; static defaultProps = { @@ -47,6 +49,8 @@ export default class FileAttachmentImage extends PureComponent { loading: false, resizeMode: 'cover', resizeMethod: 'resize', + wrapperHeight: 80, + wrapperWidth: 80, }; constructor(props) { @@ -95,14 +99,16 @@ export default class FileAttachmentImage extends PureComponent { imageSize, resizeMethod, resizeMode, + wrapperHeight, + wrapperWidth, } = this.props; let height = imageHeight; let width = imageWidth; let imageStyle = {height, width}; if (imageSize === IMAGE_SIZE.Preview) { - height = 100; - width = this.calculateNeededWidth(file.height, file.width, height) || 100; + height = 80; + width = this.calculateNeededWidth(file.height, file.width, height) || 80; imageStyle = {height, width, position: 'absolute', top: 0, left: 0, borderBottomLeftRadius: 2, borderTopLeftRadius: 2}; } @@ -117,7 +123,7 @@ export default class FileAttachmentImage extends PureComponent { return ( ); } else {