Fix regression around read receipt animation from refs changes (#12100)
Signed-off-by: Michael Telatynski <7t3chguy@gmail.com>pull/28788/head^2
parent
46e350a957
commit
2c714e2d9c
|
@ -14,7 +14,7 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
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";
|
import ReactDom from "react-dom";
|
||||||
|
|
||||||
interface IChildProps {
|
interface IChildProps {
|
||||||
|
@ -31,6 +31,8 @@ interface IProps {
|
||||||
|
|
||||||
// a list of state objects to apply to each child node in turn
|
// a list of state objects to apply to each child node in turn
|
||||||
startStyles: React.CSSProperties[];
|
startStyles: React.CSSProperties[];
|
||||||
|
|
||||||
|
innerRef?: MutableRefObject<any>;
|
||||||
}
|
}
|
||||||
|
|
||||||
function isReactElement(c: ReactElement | ReactFragment | ReactPortal): c is ReactElement {
|
function isReactElement(c: ReactElement | ReactFragment | ReactPortal): c is ReactElement {
|
||||||
|
@ -123,6 +125,10 @@ export default class NodeAnimator extends React.Component<IProps> {
|
||||||
}, 0);
|
}, 0);
|
||||||
}
|
}
|
||||||
this.nodes[k] = node;
|
this.nodes[k] = node;
|
||||||
|
|
||||||
|
if (this.props.innerRef) {
|
||||||
|
this.props.innerRef.current = node;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public render(): React.ReactNode {
|
public render(): React.ReactNode {
|
||||||
|
|
|
@ -208,7 +208,7 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<NodeAnimator startStyles={this.state.startStyles}>
|
<NodeAnimator startStyles={this.state.startStyles} innerRef={this.avatar}>
|
||||||
<MemberAvatar
|
<MemberAvatar
|
||||||
member={this.props.member ?? null}
|
member={this.props.member ?? null}
|
||||||
fallbackUserId={this.props.fallbackUserId}
|
fallbackUserId={this.props.fallbackUserId}
|
||||||
|
@ -216,7 +216,6 @@ export default class ReadReceiptMarker extends React.PureComponent<IProps, IStat
|
||||||
aria-live="off"
|
aria-live="off"
|
||||||
size="14px"
|
size="14px"
|
||||||
style={style}
|
style={style}
|
||||||
ref={this.avatar}
|
|
||||||
hideTitle
|
hideTitle
|
||||||
tabIndex={-1}
|
tabIndex={-1}
|
||||||
/>
|
/>
|
||||||
|
|
Loading…
Reference in New Issue