Skip to content

Commit

Permalink
Don't render the media list when there's no media
Browse files Browse the repository at this point in the history
This stops the empty compose view from scrolling on 4-inch devices.
  • Loading branch information
ticky committed Jan 5, 2017
1 parent db21724 commit cbcb7e1
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,13 @@ const UploadForm = React.createClass({
mixins: [PureRenderMixin],

render () {
const { intl } = this.props;
const { intl, media } = this.props;

const uploads = this.props.media.map(attachment => (
if (!media.size) {
return null;
}

const uploads = media.map(attachment => (
<div key={attachment.get('id')} style={{ borderRadius: '4px', marginBottom: '10px' }} className='transparent-background'>
<div style={{ width: '100%', height: '100px', borderRadius: '4px', background: `url(${attachment.get('preview_url')}) no-repeat center`, backgroundSize: 'cover' }}>
<IconButton icon='times' title={intl.formatMessage(messages.undo)} size={36} onClick={this.props.onRemoveFile.bind(this, attachment.get('id'))} />
Expand All @@ -29,7 +33,7 @@ const UploadForm = React.createClass({
));

return (
<div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden' }}>
<div style={{ marginBottom: '20px', padding: '10px', overflow: 'hidden', flexShrink: '0' }}>
{uploads}
</div>
);
Expand Down

0 comments on commit cbcb7e1

Please sign in to comment.