Skip to content

Commit

Permalink
Fixes #270 - Temporary fix
Browse files Browse the repository at this point in the history
  • Loading branch information
iamhosseindhv committed May 17, 2020
1 parent 1aa7f0b commit 3a690af
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/SnackbarProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@ class SnackbarProvider extends Component<SnackbarProviderProps, State> {
* Set the entered state of the snackbar with the given key.
*/
handleEnteredSnack: TransitionHandlerProps['onEntered'] = (node, isAppearing, key) => {
if (!key) {
throw new Error('handleEnteredSnack Cannot be called with undefined key');
}

this.setState(({ snacks }) => ({
snacks: snacks.map(item => (
item.key === key ? { ...item, entered: true } : { ...item }
Expand Down Expand Up @@ -223,7 +227,13 @@ class SnackbarProvider extends Component<SnackbarProviderProps, State> {
* waiting in the queue (if any). If after this process the queue is not empty, the
* oldest message is dismissed.
*/
handleExitedSnack: TransitionHandlerProps['onExited'] = (event, key) => {
// @ts-ignore
handleExitedSnack: TransitionHandlerProps['onExited'] = (event, key1, key2) => {
const key = key1 || key2;
if (!key) {
throw new Error('handleExitedSnack Cannot be called with undefined key');
}

this.setState((state) => {
const newState = this.processQueue({
...state,
Expand Down

0 comments on commit 3a690af

Please sign in to comment.