Skip to content
Open
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
4 changes: 3 additions & 1 deletion packages/utils/src/withDeviceRatio.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,9 @@ export interface WithRatioState {
}

export const withDeviceRatio = () => {
return <TProps extends WithRatioProps>(OriginalComponent: React.ComponentClass<TProps>) => {
return <TProps extends WithRatioProps>(
OriginalComponent: React.ComponentClass<TProps> | React.FunctionComponent<TProps>,
) => {
return class WithRatio extends React.Component<Omit<TProps, "ratio">, WithRatioState> {
public readonly ref = React.createRef<HTMLCanvasElement>();

Expand Down
4 changes: 3 additions & 1 deletion packages/utils/src/withSize.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@ export interface WithSizeProps {
}

export const withSize = (props?: Omit<AutoSizerProps, "children">) => {
return <TProps extends WithSizeProps>(OriginalComponent: React.ComponentClass<TProps>) => {
return <TProps extends WithSizeProps>(
OriginalComponent: React.ComponentClass<TProps> | React.FunctionComponent<TProps>,
) => {
return class WithSize extends React.Component<Omit<TProps, "width" | "height">> {
public render() {
return (
Expand Down