Skip to content

Commit

Permalink
remove withCurrentReportID HOC from withCurrentReportID file
Browse files Browse the repository at this point in the history
  • Loading branch information
etCoderDysto committed Dec 31, 2024
1 parent 0bd8984 commit cf74dcc
Showing 1 changed file with 1 addition and 27 deletions.
28 changes: 1 addition & 27 deletions src/components/withCurrentReportID.tsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
import type {NavigationState} from '@react-navigation/native';
import type {ComponentType, ForwardedRef, RefAttributes} from 'react';
import React, {createContext, forwardRef, useCallback, useMemo, useState} from 'react';
import getComponentDisplayName from '@libs/getComponentDisplayName';
import React, {createContext, useCallback, useMemo, useState} from 'react';
import Navigation from '@libs/Navigation/Navigation';

type CurrentReportIDContextValue = {
Expand Down Expand Up @@ -61,29 +59,5 @@ function CurrentReportIDContextProvider(props: CurrentReportIDContextProviderPro

CurrentReportIDContextProvider.displayName = 'CurrentReportIDContextProvider';

export default function withCurrentReportID<TProps extends CurrentReportIDContextValue, TRef>(
WrappedComponent: ComponentType<TProps & RefAttributes<TRef>>,
): (props: Omit<TProps, keyof CurrentReportIDContextValue> & React.RefAttributes<TRef>) => React.ReactElement | null {
function WithCurrentReportID(props: Omit<TProps, keyof CurrentReportIDContextValue>, ref: ForwardedRef<TRef>) {
return (
<CurrentReportIDContext.Consumer>
{(currentReportIDUtils) => (
<WrappedComponent
// eslint-disable-next-line react/jsx-props-no-spreading
{...currentReportIDUtils}
// eslint-disable-next-line react/jsx-props-no-spreading
{...(props as TProps)}
ref={ref}
/>
)}
</CurrentReportIDContext.Consumer>
);
}

WithCurrentReportID.displayName = `withCurrentReportID(${getComponentDisplayName(WrappedComponent)})`;

return forwardRef(WithCurrentReportID);
}

export {withCurrentReportIDDefaultProps, CurrentReportIDContextProvider, CurrentReportIDContext};
export type {CurrentReportIDContextValue};

0 comments on commit cf74dcc

Please sign in to comment.