Animate read receipts for all component updates

This commit is contained in:
Germain Souquet 2021-04-08 10:36:38 +01:00
parent 8d60d85570
commit 86d2e577cf

View file

@ -106,7 +106,18 @@ export default class ReadReceiptMarker extends React.PureComponent {
// we've already done our display - nothing more to do. // we've already done our display - nothing more to do.
return; return;
} }
this._animateMarker();
}
componentDidUpdate(prevProps) {
const differentLeftOffset = prevProps.leftOffset !== this.props.leftOffset;
const visibilityChanged = prevProps.hidden !== this.props.hidden;
if (differentLeftOffset || visibilityChanged) {
this._animateMarker();
}
}
_animateMarker() {
// treat new RRs as though they were off the top of the screen // treat new RRs as though they were off the top of the screen
let oldTop = -15; let oldTop = -15;