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
[transition] Allow more accurate PropTypes #8858
[transition] Allow more accurate PropTypes #8858
Conversation
Do we need the same change for flow? |
probably yes. I never worked with flow but.. https://github.com/callemall/material-ui/blob/v1-beta/src/internal/transition.js - there are no TransitionProps here. So I'm guessing you mean type information in concrete transitions like here: The only problem I see is this line: https://github.com/callemall/material-ui/blob/v1-beta/src/transitions/Grow.js#L200 |
@apieceofbart I'm continuing the PR. I'm gonna simplify the current situation by only accepting a component. This should make things more consistent with the other components and be more accurate. |
4e27a96
to
5505c53
Compare
b8b35ed
to
2cd68e6
Compare
Sure, go ahead. Let me know if I can help |
2cd68e6
to
7c2dda6
Compare
@apieceofbart I hope this change address your issue too. |
@oliviertassinari thanks for the change but I think this PR didn't include the changes in props typings - namely TransitionProps require |
@apieceofbart Sounds like an issue on the examples side. Where have you seen them? The |
https://material-ui.com/demos/snackbars/ in the Transition section: function TransitionLeft(props) {
return <Slide direction="left" {...props} />;
}
function TransitionUp(props) {
return <Slide direction="up" {...props} />;
}
function TransitionRight(props) {
return <Slide direction="right" {...props} />;
}
function TransitionDown(props) {
return <Slide direction="down" {...props} />;
} |
@apieceofbart This looks good to me. The parent should be injecting the in and children property. |
hmmm but Those examples clearly don't pass |
If you ask me the best solution would be to leave adding transition to developer. I would then pass my component wrapper with Transition as children to |
The Snackbar component do pass the children property. I don't get where is the issue. Do you have a codesandbox I can have a look at? |
The |
The children is a property like another. It will be spread. |
Yeah you're right, sorry for that! I was working with wrong example without |
As discussed here: #8785 setting
children
andin
props as optional should be brought back to allow using transitions as a props in other components e.g. Snackbar.I did not add any new tests, I believe there are no tests for checking types.
Breaking change
This breaking change increases the consistency of our API. Also, it's allowing a more strict typing definition that can help spotting issues. One important thing to notice is that the component creation needs to be outside of the render method. Otherwise, a new instance will be created and the animation will lose his state.