From 151a30485711422557d33713af8fb2c65a2d371b Mon Sep 17 00:00:00 2001 From: Elias Nahum Date: Wed, 5 Jun 2019 17:58:28 -0400 Subject: [PATCH] Fix opengraph image on tablet to account for the sidebar (#2863) --- .../post_attachment_opengraph/post_attachment_opengraph.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/components/post_attachment_opengraph/post_attachment_opengraph.js b/app/components/post_attachment_opengraph/post_attachment_opengraph.js index 5e50e6107..d74293ea7 100644 --- a/app/components/post_attachment_opengraph/post_attachment_opengraph.js +++ b/app/components/post_attachment_opengraph/post_attachment_opengraph.js @@ -12,6 +12,9 @@ import { View, } from 'react-native'; +import {TABLET_WIDTH} from 'app/components/sidebars/drawer_layout'; +import {DeviceTypes} from 'app/constants'; + import ImageCacheManager from 'app/utils/image_cache_manager'; import {previewImageAtIndex, calculateDimensions} from 'app/utils/images'; import {getNearestPoint} from 'app/utils/opengraph'; @@ -162,8 +165,9 @@ export default class PostAttachmentOpenGraph extends PureComponent { const {deviceHeight, deviceWidth, isReplyPost} = this.props; const deviceSize = deviceWidth > deviceHeight ? deviceHeight : deviceWidth; const viewPortWidth = deviceSize - VIEWPORT_IMAGE_OFFSET - (isReplyPost ? VIEWPORT_IMAGE_REPLY_OFFSET : 0); + const tabletOffset = DeviceTypes.IS_TABLET ? TABLET_WIDTH : 0; - return viewPortWidth; + return viewPortWidth - tabletOffset; }; goToLink = () => {