Skip to content

Commit

Permalink
feat: support render props children
Browse files Browse the repository at this point in the history
  • Loading branch information
IVLIU committed Mar 1, 2024
1 parent 5d191f0 commit 9fe2b01
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/Repeater.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,5 +56,5 @@ export const Repeater: FC<IProps> = (props) => {

resolvePromise();

return <>{children}</>;
return <>{typeof children === 'function' ? children(mode) : children}</>;
};
2 changes: 1 addition & 1 deletion src/type.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export type ActivityMode = 'visible' | 'hidden';

export interface IProps {
mode: ActivityMode;
children: ReactNode;
children: ReactNode | ((mode: ActivityMode) => ReactNode);
}

0 comments on commit 9fe2b01

Please sign in to comment.