Fix opengraph image on tablet to account for the sidebar (#2863)

This commit is contained in:
Elias Nahum 2019-06-05 17:58:28 -04:00
parent 2a443b35f5
commit 151a304857
No known key found for this signature in database
GPG key ID: E038DB71E0B61702

View file

@ -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 = () => {