Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
JediWattson committed Jan 18, 2023
1 parent 9efe361 commit a8daa2b
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 32 deletions.
1 change: 0 additions & 1 deletion src/components/AttachmentCarousel/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ const defaultProps = {
class AttachmentCarousel extends React.Component {
constructor(props) {
super(props);
console.log(this.props.sourceURL);
this.canUseTouchScreen = DeviceCapabilities.canUseTouchScreen();
this.makeStateWithReports = this.makeStateWithReports.bind(this);
this.cycleThroughAttachments = this.cycleThroughAttachments.bind(this);
Expand Down
31 changes: 0 additions & 31 deletions src/components/ImageView/index.native.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,37 +71,6 @@ class ImageView extends PureComponent {
this.state.interactionPromise.cancel();
}

calculateImageSize() {
if (!this.props.url) {
return;
}

this.setState({imageHeight: undefined, imageWidth: undefined});
Image.getSize(this.props.url).then(({width, height, rotation}) => {
let imageWidth = width;
let imageHeight = height;
const containerWidth = Math.round(this.props.windowWidth);
const containerHeight = Math.round(this.state.containerHeight);

// On specific Android devices, the dimensions are sometimes returned to us flipped here, with `rotation` set to 90 degrees.
// Swap them back to make sure the image fits nicely in the container. On iOS, the rotation is always undefined, so this does not apply.
if (rotation === 90 || rotation === 270) {
[imageWidth, imageHeight] = [imageHeight, imageWidth];
}

const aspectRatio = Math.min(containerHeight / imageHeight, containerWidth / imageWidth);

imageHeight *= aspectRatio;
imageWidth *= aspectRatio;

// Resize the image to max dimensions possible on the Native platforms to prevent crashes on Android. To keep the same behavior, apply to IOS as well.
const maxDimensionsScale = 11;
imageHeight = Math.min(imageHeight, (this.props.windowHeight * maxDimensionsScale));
imageWidth = Math.min(imageWidth, (this.props.windowWidth * maxDimensionsScale));
this.setState({imageHeight, imageWidth});
});
}

/**
* Updates the amount of active touches on the PanResponder on our ImageZoom overlay View
*
Expand Down

0 comments on commit a8daa2b

Please sign in to comment.