mirror of
https://github.com/wassname/talk.git
synced 2026-08-06 13:41:02 +08:00
Forward Ref Stub
This commit is contained in:
@@ -1,9 +1,9 @@
|
||||
import cn from "classnames";
|
||||
import React from "react";
|
||||
import React, { Ref } from "react";
|
||||
import TimeAgo, { Formatter } from "react-timeago";
|
||||
|
||||
import { UIContext } from "talk-ui/components";
|
||||
import { withStyles } from "talk-ui/hocs";
|
||||
import { withForwardRef, withStyles } from "talk-ui/hocs";
|
||||
import { PropTypesOf } from "talk-ui/types";
|
||||
|
||||
import * as styles from "./RelativeTime.css";
|
||||
@@ -14,6 +14,12 @@ interface InnerProps {
|
||||
classes: typeof styles;
|
||||
className?: string;
|
||||
formatter?: Formatter;
|
||||
|
||||
/** Ref to the root element */
|
||||
ref?: Ref<HTMLDivElement>;
|
||||
|
||||
/** Internal: Forwarded Ref */
|
||||
forwardRef?: Ref<HTMLDivElement>;
|
||||
}
|
||||
|
||||
const defaultFormatter: Formatter = (value, unit, suffix, timestamp: string) =>
|
||||
@@ -37,6 +43,6 @@ class RelativeTime extends React.Component<InnerProps> {
|
||||
}
|
||||
}
|
||||
|
||||
const enhanced = withStyles(styles)(RelativeTime);
|
||||
const enhanced = withForwardRef(withStyles(styles)(RelativeTime));
|
||||
export type RelativeTimeProps = PropTypesOf<typeof enhanced>;
|
||||
export default enhanced;
|
||||
|
||||
Reference in New Issue
Block a user