Skip to content

Commit

Permalink
Merge branch 'add-toast-props-to-content-callback' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
fkhadra committed Dec 8, 2020
2 parents 88af130 + db996ae commit c834a24
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/hooks/useToastContainer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -232,10 +232,11 @@ export function useToastContainer(props: ToastContainerProps) {

if (isValidElement(content) && !isStr(content.type)) {
toastContent = cloneElement(content, {
closeToast
closeToast,
toastProps
});
} else if (isFn(content)) {
toastContent = content({ closeToast });
toastContent = content({ closeToast, toastProps });
}

// not handling limit + delay by design. Waiting for user feedback first
Expand Down
1 change: 1 addition & 0 deletions src/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export type ToastPosition =

export interface ToastContentProps {
closeToast?: () => void;
toastProps: ToastProps;
}
export type ToastContent =
| React.ReactNode
Expand Down

0 comments on commit c834a24

Please sign in to comment.