mirror of https://github.com/vector-im/riot-web
Fix regression around read receipt animation from refs changes (#12100)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28217/head
parent
46e350a957
commit
2c714e2d9c
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
@ -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 {
|
||||
|
|
|
@ -208,7 +208,7 @@ 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}
|
||||
|
@ -216,7 +216,6 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
|
|||
aria-live="off"
|
||||
size="14px"
|
||||
style={style}
|
||||
ref={this.avatar}
|
||||
hideTitle
|
||||
tabIndex={-1}
|
||||
/>
|
||||
|
|
Loading…
Reference in New Issue