Skip to content

Commit

Permalink
Allow snackbar children to of type function (#114)
Browse files Browse the repository at this point in the history
  • Loading branch information
jgodi authored and iamhosseindhv committed Apr 27, 2019
1 parent 21e5854 commit fa231cc
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/SnackbarItem/SnackbarItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,11 @@ class SnackbarItem extends Component {
finalAction = contentProps.action(key);
}

let snackChildren = snack.children;
if (snackChildren && typeof snackChildren === 'function') {
snackChildren = snackChildren(key);
}

return (
<RootRef rootRef={this.ref}>
<Snackbar
Expand All @@ -103,7 +108,7 @@ class SnackbarItem extends Component {
onClose={this.handleClose(key)}
onExited={this.handleExited(key)}
>
{snack.children || (
{snackChildren || (
<SnackbarContent
className={classNames(
classes.base,
Expand Down

0 comments on commit fa231cc

Please sign in to comment.