Recompute hero row size when it appears
This commit is contained in:
parent
11855d1585
commit
9ff1c1e50d
1 changed files with 10 additions and 4 deletions
|
@ -1020,6 +1020,7 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
||||||
): void {
|
): void {
|
||||||
const {
|
const {
|
||||||
clearChangedMessages,
|
clearChangedMessages,
|
||||||
|
haveOldest,
|
||||||
id,
|
id,
|
||||||
isIncomingMessageRequest,
|
isIncomingMessageRequest,
|
||||||
items,
|
items,
|
||||||
|
@ -1030,13 +1031,18 @@ export class Timeline extends React.PureComponent<PropsType, StateType> {
|
||||||
typingContact,
|
typingContact,
|
||||||
} = this.props;
|
} = this.props;
|
||||||
|
|
||||||
// Warnings can increase the size of the first row (adding padding for the floating
|
// We recompute the hero row's height if:
|
||||||
// warning), so we recompute it when the warnings change.
|
//
|
||||||
|
// 1. We just started showing it (a loading row changes to a hero row)
|
||||||
|
// 2. Warnings were shown (they add padding to the hero for the floating warning)
|
||||||
|
const hadOldest = prevProps.haveOldest;
|
||||||
const hadWarning = Boolean(
|
const hadWarning = Boolean(
|
||||||
prevProps.warning && !prevState.hasDismissedDirectContactSpoofingWarning
|
prevProps.warning && !prevState.hasDismissedDirectContactSpoofingWarning
|
||||||
);
|
);
|
||||||
if (hadWarning !== Boolean(this.getWarning())) {
|
const shouldRecomputeRowHeights =
|
||||||
this.recomputeRowHeights(0);
|
(!hadOldest && haveOldest) || hadWarning !== Boolean(this.getWarning());
|
||||||
|
if (shouldRecomputeRowHeights) {
|
||||||
|
this.resizeHeroRow();
|
||||||
}
|
}
|
||||||
|
|
||||||
// There are a number of situations which can necessitate that we forget about row
|
// There are a number of situations which can necessitate that we forget about row
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue