Skip to content
This repository has been archived by the owner on Sep 11, 2024. It is now read-only.

Commit

Permalink
Fix regression around read receipt animation from refs changes (#12100)
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Telatynski <[email protected]>
  • Loading branch information
t3chguy authored Jan 3, 2024
1 parent 46e350a commit 2c714e2
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
8 changes: 7 additions & 1 deletion src/NodeAnimator.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
limitations under the License.
*/

import React, { Key, ReactElement, ReactFragment, ReactInstance, ReactPortal } from "react";
import React, { Key, MutableRefObject, ReactElement, ReactFragment, ReactInstance, ReactPortal } from "react";
import ReactDom from "react-dom";

interface IChildProps {
Expand All @@ -31,6 +31,8 @@ interface IProps {

// a list of state objects to apply to each child node in turn
startStyles: React.CSSProperties[];

innerRef?: MutableRefObject<any>;
}

function isReactElement(c: ReactElement | ReactFragment | ReactPortal): c is ReactElement {
Expand Down Expand Up @@ -123,6 +125,10 @@ export default class NodeAnimator extends React.Component<IProps> {
}, 0);
}
this.nodes[k] = node;

if (this.props.innerRef) {
this.props.innerRef.current = node;
}
}

public render(): React.ReactNode {
Expand Down
3 changes: 1 addition & 2 deletions src/components/views/rooms/ReadReceiptMarker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -208,15 +208,14 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
};

return (
<NodeAnimator startStyles={this.state.startStyles}>
<NodeAnimator startStyles={this.state.startStyles} innerRef={this.avatar}>
<MemberAvatar
member={this.props.member ?? null}
fallbackUserId={this.props.fallbackUserId}
aria-hidden="true"
aria-live="off"
size="14px"
style={style}
ref={this.avatar}
hideTitle
tabIndex={-1}
/>
Expand Down

0 comments on commit 2c714e2

Please sign in to comment.