diff --git a/app/components/file_attachment_list/file_attachment.js b/app/components/file_attachment_list/file_attachment.js index a57eb99d5..d54f99c3b 100644 --- a/app/components/file_attachment_list/file_attachment.js +++ b/app/components/file_attachment_list/file_attachment.js @@ -8,6 +8,7 @@ import React, { import { Text, + TouchableOpacity, View, StyleSheet } from 'react-native'; @@ -25,6 +26,8 @@ export default class FileAttachment extends PureComponent { addFileToFetchCache: PropTypes.func.isRequired, fetchCache: PropTypes.object.isRequired, file: PropTypes.object.isRequired, + onInfoPress: PropTypes.func.isRequired, + onPreviewPress: PropTypes.func.isRequired, theme: PropTypes.object.isRequired }; @@ -33,7 +36,7 @@ export default class FileAttachment extends PureComponent { const style = getStyleSheet(theme); return ( - + { + this.props.onPreviewPress(this.props.file); + } + render() { const {file, theme} = this.props; const style = getStyleSheet(theme); @@ -79,8 +86,15 @@ export default class FileAttachment extends PureComponent { return ( - {fileAttachmentComponent} - {this.renderFileInfo()} + + {fileAttachmentComponent} + + + {this.renderFileInfo()} + ); } diff --git a/app/components/file_attachment_list/file_attachment_list.js b/app/components/file_attachment_list/file_attachment_list.js index 049c2f0e9..769f20ecc 100644 --- a/app/components/file_attachment_list/file_attachment_list.js +++ b/app/components/file_attachment_list/file_attachment_list.js @@ -21,6 +21,7 @@ export default class FileAttachmentList extends Component { files: PropTypes.array.isRequired, hideOptionsContext: PropTypes.func.isRequired, onLongPress: PropTypes.func, + onPress: PropTypes.func, post: PropTypes.object.isRequired, theme: PropTypes.object.isRequired, toggleSelected: PropTypes.func.isRequired @@ -31,9 +32,14 @@ export default class FileAttachmentList extends Component { this.props.actions.loadFilesForPostIfNecessary(post); } - handleOnPress = (file) => { + handleInfoPress = () => { this.props.hideOptionsContext(); - this.props.actions.goToImagePreviewModal(this.props.post, file.id); + this.props.onPress(); + } + + handlePreviewPress = (file) => { + this.props.hideOptionsContext(); + preventDoubleTap(this.props.actions.goToImagePreviewModal, this, this.props.post, file.id); }; render() { @@ -41,7 +47,6 @@ export default class FileAttachmentList extends Component { preventDoubleTap(this.handleOnPress, this, file)} onPressIn={() => this.props.toggleSelected(true)} onPressOut={() => this.props.toggleSelected(false)} > @@ -49,6 +54,8 @@ export default class FileAttachmentList extends Component { addFileToFetchCache={this.props.actions.addFileToFetchCache} fetchCache={this.props.fetchCache} file={file} + onInfoPress={this.handleInfoPress} + onPreviewPress={this.handlePreviewPress} theme={this.props.theme} /> diff --git a/app/components/post/post.js b/app/components/post/post.js index 389e817e4..193b425fb 100644 --- a/app/components/post/post.js +++ b/app/components/post/post.js @@ -212,6 +212,7 @@ class Post extends PureComponent { diff --git a/app/scenes/image_preview/image_preview.js b/app/scenes/image_preview/image_preview.js index 156d7079e..a8d442046 100644 --- a/app/scenes/image_preview/image_preview.js +++ b/app/scenes/image_preview/image_preview.js @@ -60,7 +60,7 @@ export default class ImagePreview extends PureComponent { const currentFile = props.files.findIndex((file) => file.id === props.fileId); this.state = { currentFile, - deviceHeight, + deviceHeight: deviceHeight - STATUSBAR_HEIGHT, deviceWidth, drag: new Animated.ValueXY(), footerOpacity: new Animated.Value(1),