From 4dab09337971a69aed62dad50f2a8d4aaa589d6c Mon Sep 17 00:00:00 2001 From: Christophe VERCLYTTE <1611574+chris-verclytte@users.noreply.github.com> Date: Fri, 20 Oct 2023 21:29:39 +0200 Subject: [PATCH] fix(utils): add FC support for withSize and withDeviceRatio HOC --- packages/utils/src/withDeviceRatio.tsx | 4 +++- packages/utils/src/withSize.tsx | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/packages/utils/src/withDeviceRatio.tsx b/packages/utils/src/withDeviceRatio.tsx index ce9205c63..fc16df110 100644 --- a/packages/utils/src/withDeviceRatio.tsx +++ b/packages/utils/src/withDeviceRatio.tsx @@ -9,7 +9,9 @@ export interface WithRatioState { } export const withDeviceRatio = () => { - return (OriginalComponent: React.ComponentClass) => { + return ( + OriginalComponent: React.ComponentClass | React.FunctionComponent, + ) => { return class WithRatio extends React.Component, WithRatioState> { public readonly ref = React.createRef(); diff --git a/packages/utils/src/withSize.tsx b/packages/utils/src/withSize.tsx index 8f4c7ee4e..b355d5d5d 100644 --- a/packages/utils/src/withSize.tsx +++ b/packages/utils/src/withSize.tsx @@ -7,7 +7,9 @@ export interface WithSizeProps { } export const withSize = (props?: Omit) => { - return (OriginalComponent: React.ComponentClass) => { + return ( + OriginalComponent: React.ComponentClass | React.FunctionComponent, + ) => { return class WithSize extends React.Component> { public render() { return (