Skip to content

Commit

Permalink
Use children instead of render prop
Browse files Browse the repository at this point in the history
  • Loading branch information
timolins committed May 16, 2021
1 parent ff9a762 commit 8388051
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/components/toaster.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,20 +44,20 @@ const getPositionStyle = (

interface ToasterProps {
position?: ToastPosition;
toastOptions?: DefaultToastOptions;
reverseOrder?: boolean;
gutter?: number;
containerStyle?: React.CSSProperties;
containerClassName?: string;

toastOptions?: DefaultToastOptions;
renderToast?: (toast: Toast) => JSX.Element;
children?: (toast: Toast) => JSX.Element;
}
const DEFAULT_OFFSET = 16;

export const Toaster: React.FC<ToasterProps> = ({
reverseOrder,
position = 'top-center',
gutter,
children,
containerStyle,
toastOptions,
containerClassName,
Expand Down Expand Up @@ -107,8 +107,8 @@ export const Toaster: React.FC<ToasterProps> = ({
>
{t.type === 'custom' ? (
resolveValue(t.message, t)
) : renderToast ? (
renderToast(t)
) : children ? (
children(t)
) : (
<ToastBar toast={t} position={toastPosition} />
)}
Expand Down

0 comments on commit 8388051

Please sign in to comment.