Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Snackbar: transition does not work with SnackbarContent #16637

Closed
abraaobuenotype opened this issue Jul 18, 2019 · 8 comments
Closed

Snackbar: transition does not work with SnackbarContent #16637

abraaobuenotype opened this issue Jul 18, 2019 · 8 comments
Labels
support: Stack Overflow Please ask the community on Stack Overflow

Comments

@abraaobuenotype
Copy link

occurrence:
snackbar

error:
image

@mbrookes mbrookes added the support: Stack Overflow Please ask the community on Stack Overflow label Jul 18, 2019
@support
Copy link

support bot commented Jul 18, 2019

👋 Thanks for using Material-UI!

We use the issue tracker exclusively for bug reports and feature requests, however,
this issue appears to be a support request or question. Please ask on StackOverflow where the
community will do their best to help. There is a "material-ui" tag that you can use to tag your
question.

If you would like to link from here to your question on SO, it will help others find it.
If your issues is confirmed as a bug, you are welcome to reopen the issue using the issue template.

@support support bot closed this as completed Jul 18, 2019
@mbrookes
Copy link
Member

I suspect the issue is MySnackbarContentWrapper (but hard to say without a link to the sandbox. Is it a function component? If so, please read the page linked in the error message, it should answer your question.

@abraaobuenotype
Copy link
Author

I just added a Slide in the sandbox of the documentation example itself

https://codesandbox.io/s/material-demo-yhmo9

@eps1lon
Copy link
Member

eps1lon commented Jul 18, 2019

children | element |   | A single child content element.⚠️ Needs to be able to hold a ref.

-- https://material-ui.com/api/slide/#props

vs. the default Grow:

children | element |   | A single child content element.

-- https://material-ui.com/api/grow/#props

Our composition guide hopefully helps you fix this issue.

@mbrookes
Copy link
Member

So, yeah, MySnackbarContentWrapper is a function component, so like the error message says, you need to wrap it with React.forwardRef:

https://codesandbox.io/s/material-demo-qzxom

@abraaobuenotype
Copy link
Author

Fantastic. Thank you very much

@Vang-z
Copy link

Vang-z commented Jul 28, 2019

now, I have a another problem, transition does not work when the snackbar close.It's just work with init directions, if I use direction('left' || 'right' || 'up' || 'down'), It doesnt work....
11
1
22
2

@abraaobuenotype
Copy link
Author

as @mbrookes said, it worked for me doing this:

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
support: Stack Overflow Please ask the community on Stack Overflow
Projects
None yet
Development

No branches or pull requests

4 participants