From bdbeb002d00312421cba3a530daddb1a423c75a8 Mon Sep 17 00:00:00 2001 From: Simon Bos Date: Sun, 17 Nov 2019 13:39:24 +0100 Subject: [PATCH 1/2] Safe override of TransitionProps --- src/SnackbarItem/SnackbarItem.js | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.js b/src/SnackbarItem/SnackbarItem.js index a50d5200..860ebb24 100644 --- a/src/SnackbarItem/SnackbarItem.js +++ b/src/SnackbarItem/SnackbarItem.js @@ -63,6 +63,7 @@ class SnackbarItem extends Component { iconVariant, snack, dense, + TransitionProps: otherTransitionProps = {}, ...other } = this.props; @@ -79,6 +80,7 @@ class SnackbarItem extends Component { anchorOrigin, requestClose, entered, + TransitionProps: singleTransitionProps = {}, ...singleSnackProps } = snack; @@ -90,6 +92,13 @@ class SnackbarItem extends Component { action: singleAction || singleContentProps.action || contentAction || action, }; + const transitionProps = { + ...otherTransitionProps, + ...singleTransitionProps, + direction: getTransitionDirection(anchorOrigin), + onExited: this.handleExitedScreen, + }; + const ariaDescribedby = contentProps['aria-describedby'] || 'client-snackbar'; let finalAction = contentProps.action; @@ -119,10 +128,7 @@ class SnackbarItem extends Component { onExited={this.handleExited(key)} > Date: Sun, 1 Dec 2019 19:00:49 +0000 Subject: [PATCH 2/2] Allow transition direction to be overridden --- src/SnackbarItem/SnackbarItem.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/SnackbarItem/SnackbarItem.js b/src/SnackbarItem/SnackbarItem.js index 860ebb24..f20886cc 100644 --- a/src/SnackbarItem/SnackbarItem.js +++ b/src/SnackbarItem/SnackbarItem.js @@ -93,9 +93,9 @@ class SnackbarItem extends Component { }; const transitionProps = { + direction: getTransitionDirection(anchorOrigin), ...otherTransitionProps, ...singleTransitionProps, - direction: getTransitionDirection(anchorOrigin), onExited: this.handleExitedScreen, }; @@ -128,11 +128,11 @@ class SnackbarItem extends Component { onExited={this.handleExited(key)} >