mirror of
https://github.com/mastodon/mastodon.git
synced 2024-12-16 23:22:01 +00:00
Only compute height dynamically for standalone media
This prevents changing the status' height and triggering jumps in the TL
This commit is contained in:
parent
52229405ed
commit
779aa707ec
|
@ -238,7 +238,7 @@ export default class MediaGallery extends React.PureComponent {
|
|||
}
|
||||
|
||||
handleRef = (node) => {
|
||||
if (node /*&& this.isStandaloneEligible()*/) {
|
||||
if (node && this.isStandaloneEligible()) {
|
||||
// offsetWidth triggers a layout, so only calculate when we need to
|
||||
this.setState({
|
||||
width: node.offsetWidth,
|
||||
|
@ -260,13 +260,9 @@ export default class MediaGallery extends React.PureComponent {
|
|||
|
||||
const style = {};
|
||||
|
||||
if (this.isStandaloneEligible()) {
|
||||
if (width) {
|
||||
if (this.isStandaloneEligible() && width) {
|
||||
style.height = width / this.props.media.getIn([0, 'meta', 'small', 'aspect']);
|
||||
}
|
||||
} else if (width) {
|
||||
style.height = width / (16/9);
|
||||
}
|
||||
|
||||
if (!visible) {
|
||||
let warning = <FormattedMessage {...(sensitive ? messages.warning : messages.hidden)} />;
|
||||
|
|
Loading…
Reference in a new issue