// ...
import RMCPullToRefresh from "rmc-pull-to-refresh";
const PullToRefresh = ({ onRefresh, children }: IPullToRefreshProps) => {
// my other logics
return (
<RMCPullToRefresh
getScrollContainer={() => document.body}
direction="down"
scale={1}
distanceToRefresh={REFRESH_DISTANCE}
onRefresh={onRefresh}
indicator={{
activate: <ActivateIndicator />,
deactivate: <DeactivateIndicator />,
finish: <FinishIndicator />,
release: <ReleaseIndicator />,
}}
damping={REFRESH_DISTANCE}
>
{children}
</RMCPullToRefresh>
);
};
Compiled with problems:
ERROR in src/components/PullToRefresh/PullToRefresh.tsx:128:7
TS2769: No overload matches this call.
Overload 1 of 2, '(props: PropsType | Readonly<PropsType>): PullToRefresh', gave the following error.
Type '() => HTMLElement' is not assignable to type '() => ReactNode'.
Type 'HTMLElement' is not assignable to type 'ReactNode'.
Type 'HTMLElement' is missing the following properties from type 'ReactPortal': key, type, props
Overload 2 of 2, '(props: PropsType, context: any): PullToRefresh', gave the following error.
Type '() => HTMLElement' is not assignable to type '() => ReactNode'.
126 | return (
127 | <RMCPullToRefresh
> 128 | getScrollContainer={() => document.body}
| ^^^^^^^^^^^^^^^^^^
129 | direction="down"
130 | scale={1}
131 | distanceToRefresh={REFRESH_DISTANCE}
export interface PropsType {
getScrollContainer: () => HTMLElement;
direction: "down" | "up";
refreshing?: boolean;
distanceToRefresh: number;
onRefresh: () => void;
indicator: Indicator;
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
damping?: number;
scale?: number;
children?: ReactNode;
}
export interface PropsType {
getScrollContainer: () => React.ReactNode;
direction: 'down' | 'up';
refreshing?: boolean;
distanceToRefresh: number;
onRefresh: () => void;
indicator: Indicator;
prefixCls?: string;
className?: string;
style?: React.CSSProperties;
damping?: number;
scale?: number;
}