Skip to content

Commit

Permalink
Fixes #270 - Temporary fix (#271)
Browse files Browse the repository at this point in the history
* Fixes #270 - Temporary fix

* Update CHANGELOG
  • Loading branch information
iamhosseindhv authored May 17, 2020
1 parent 1aa7f0b commit 297f229
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
10 changes: 9 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,21 @@
Thanks to all contributers who improved notistack by opening an issue/PR.

### `notistack@0.9.15`
### `notistack@0.9.16`
###### to be published
* **@pctestjfarz**: Add swipe to dismiss feature [#138](https://github.com/iamhosseindhv/notistack/issues/138)
* **@molynerd**: Add support to update content of snackbar in place [#50](https://github.com/iamhosseindhv/notistack/issues/50)
* **@david-chau**: Allow `asc`, `desc` or custom sort order of snackbars [#160](https://github.com/iamhosseindhv/notistack/issues/160)



<br />


### `notistack@0.9.15`
###### May 17, 2020
* **@nebojsanb**: Fix bug with displaying snackbars [#270](https://github.com/iamhosseindhv/notistack/issues/270)


<br />


Expand Down
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 297f229

Please sign in to comment.