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

Fix regression around read receipt animation from refs changes #12100

Merged
merged 1 commit into from
Jan 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading