File image attachments sometimes do not open the image preview (#2397)

This commit is contained in:
Chris Duarte 2018-11-30 06:17:34 -08:00 committed by Harrison Healey
parent ccaa1a1c11
commit 6163b8e913
2 changed files with 4 additions and 0 deletions

View file

@ -23,6 +23,7 @@ export default class FileAttachment extends PureComponent {
canDownloadFiles: PropTypes.bool.isRequired,
deviceWidth: PropTypes.number.isRequired,
file: PropTypes.object.isRequired,
id: PropTypes.string.isRequired,
index: PropTypes.number.isRequired,
onCaptureRef: PropTypes.func,
onLongPress: PropTypes.func,
@ -102,6 +103,7 @@ export default class FileAttachment extends PureComponent {
if ((data && data.has_preview_image) || file.loading || isGif(data)) {
fileAttachmentComponent = (
<TouchableOpacity
key={`${this.props.id}${file.loading}`}
onPress={this.handlePreviewPress}
onLongPress={onLongPress}
>

View file

@ -133,6 +133,7 @@ export default class FileAttachmentList extends Component {
canDownloadFiles={canDownloadFiles}
deviceWidth={deviceWidth}
file={{loading: true}}
id={id}
index={idx}
theme={this.props.theme}
/>
@ -151,6 +152,7 @@ export default class FileAttachmentList extends Component {
canDownloadFiles={canDownloadFiles}
deviceWidth={deviceWidth}
file={f}
id={file.id}
index={idx}
navigator={navigator}
onCaptureRef={this.handleCaptureRef}