iOS: Fix message height jump on load (#3544)
This commit is contained in:
parent
f6d9f324fe
commit
faab9b15e8
@ -101,7 +101,7 @@
|
||||
.emoji {
|
||||
width: calc(1.125 * var(--message-text-size, 1rem)) !important;
|
||||
height: calc(1.125 * var(--message-text-size, 1rem)) !important;
|
||||
vertical-align: text-bottom !important;
|
||||
vertical-align: bottom !important;
|
||||
}
|
||||
|
||||
.custom-emoji {
|
||||
|
||||
@ -21,6 +21,7 @@
|
||||
.invoice-image {
|
||||
position: relative;
|
||||
width: 100%;
|
||||
max-width: 100%;
|
||||
max-height: 30rem;
|
||||
object-fit: cover;
|
||||
border-bottom-left-radius: var(--border-bottom-left-radius);
|
||||
|
||||
@ -9,6 +9,7 @@ import { getMessageInvoice, getWebDocumentHash } from '../../../global/helpers';
|
||||
import { formatCurrency } from '../../../util/formatCurrency';
|
||||
import renderText from '../../common/helpers/renderText';
|
||||
import getCustomAppendixBg from './helpers/getCustomAppendixBg';
|
||||
import buildStyle from '../../../util/buildStyle';
|
||||
|
||||
import useLayoutEffectWithPrevDeps from '../../../hooks/useLayoutEffectWithPrevDeps';
|
||||
import useLang from '../../../hooks/useLang';
|
||||
@ -72,6 +73,14 @@ const Invoice: FC<OwnProps> = ({
|
||||
}
|
||||
}, [shouldAffectAppendix, photoUrl, isInSelectMode, isSelected, theme]);
|
||||
|
||||
const width = forcedWidth || photo?.dimensions?.width;
|
||||
|
||||
const style = buildStyle(
|
||||
photo?.dimensions && `width: ${width}px`,
|
||||
photo?.dimensions && `aspect-ratio: ${photo.dimensions.width} / ${photo.dimensions.height}`,
|
||||
Boolean(!photo?.dimensions && forcedWidth) && `width: ${forcedWidth}px`,
|
||||
);
|
||||
|
||||
return (
|
||||
<div
|
||||
ref={ref}
|
||||
@ -92,13 +101,13 @@ const Invoice: FC<OwnProps> = ({
|
||||
className="invoice-image"
|
||||
src={photoUrl}
|
||||
alt=""
|
||||
style={forcedWidth ? `width: ${forcedWidth}px` : undefined}
|
||||
style={style}
|
||||
crossOrigin="anonymous"
|
||||
/>
|
||||
)}
|
||||
{!photoUrl && photo && (
|
||||
<Skeleton
|
||||
width={forcedWidth || photo.dimensions?.width}
|
||||
width={width}
|
||||
height={photo.dimensions?.height}
|
||||
forceAspectRatio
|
||||
/>
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import type { FC } from '../../lib/teact/teact';
|
||||
import React from '../../lib/teact/teact';
|
||||
|
||||
import type { FC } from '../../lib/teact/teact';
|
||||
|
||||
import buildClassName from '../../util/buildClassName';
|
||||
import buildStyle from '../../util/buildStyle';
|
||||
|
||||
@ -27,8 +28,11 @@ const Skeleton: FC<OwnProps> = ({
|
||||
}) => {
|
||||
const classNames = buildClassName('Skeleton', variant, animation, className, inline && 'inline');
|
||||
const aspectRatio = (width && height) ? `aspect-ratio: ${width}/${height}` : undefined;
|
||||
const style = forceAspectRatio ? aspectRatio
|
||||
: buildStyle(Boolean(width) && `width: ${width}px`, Boolean(height) && `height: ${height}px`);
|
||||
const style = buildStyle(
|
||||
forceAspectRatio && aspectRatio,
|
||||
Boolean(width) && `width: ${width}px`,
|
||||
!forceAspectRatio && Boolean(height) && `height: ${height}px`,
|
||||
);
|
||||
return (
|
||||
<div className={classNames} style={style}>{inline && '\u00A0'}</div>
|
||||
);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user