This reverts commit 5f31374e74.
This commit is contained in:
parent
c8d799cb76
commit
fa5efd4007
2 changed files with 12 additions and 6 deletions
|
|
@ -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 (
|
||||
<View
|
||||
ref={this.handleCaptureRef}
|
||||
style={style.fileImageWrapper}
|
||||
style={[style.fileImageWrapper, {height: wrapperHeight, width: wrapperWidth, overflow: 'hidden'}]}
|
||||
>
|
||||
<ProgressiveImage
|
||||
style={imageStyle}
|
||||
|
|
@ -139,9 +145,6 @@ const style = StyleSheet.create({
|
|||
justifyContent: 'center',
|
||||
borderBottomLeftRadius: 2,
|
||||
borderTopLeftRadius: 2,
|
||||
height: 100,
|
||||
width: 100,
|
||||
overflow: 'hidden',
|
||||
},
|
||||
loaderContainer: {
|
||||
position: 'absolute',
|
||||
|
|
|
|||
|
|
@ -175,8 +175,11 @@ export default class FileUploadItem extends PureComponent {
|
|||
filePreviewComponent = (
|
||||
<FileAttachmentImage
|
||||
file={file}
|
||||
imageSize='fullsize'
|
||||
imageHeight={100}
|
||||
imageWidth={100}
|
||||
wrapperHeight={100}
|
||||
wrapperWidth={100}
|
||||
/>
|
||||
);
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Reference in a new issue