diff --git a/app/containers/ActionSheet/Provider.tsx b/app/containers/ActionSheet/Provider.tsx index e2b37dad9..e28d49c22 100644 --- a/app/containers/ActionSheet/Provider.tsx +++ b/app/containers/ActionSheet/Provider.tsx @@ -1,7 +1,8 @@ +import hoistNonReactStatics from 'hoist-non-react-statics'; import React, { ForwardedRef, forwardRef, useContext, useRef } from 'react'; -import ActionSheet from './ActionSheet'; import { TIconsName } from '../CustomIcon'; +import ActionSheet from './ActionSheet'; export type TActionSheetOptionsItem = { title: string; @@ -35,11 +36,15 @@ export const useActionSheet = () => useContext(context); const { Provider, Consumer } = context; -export const withActionSheet = (Component: React.ComponentType): typeof Component => - forwardRef((props: typeof React.Component, ref: ForwardedRef) => ( +export const withActionSheet = (Component: React.ComponentType): typeof Component => { + const WithActionSheetComponent = forwardRef((props: typeof React.Component, ref: ForwardedRef) => ( {(contexts: IActionSheetProvider) => } )); + hoistNonReactStatics(WithActionSheetComponent, Component); + return WithActionSheetComponent; +}; + export const ActionSheetProvider = React.memo(({ children }: { children: React.ReactElement | React.ReactElement[] }) => { const ref: ForwardedRef = useRef(null);