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
[Badge] Fix transition flicker #21557
[Badge] Fix transition flicker #21557
Conversation
@material-ui/core: parsed: +0.07% , gzip: +0.12% |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I can confirm it work, It doesn't solve 100% of the problem, but it sounds pragmatic.
There is something I have been wondering about the Badge component for some time, is whether or not we should break it down. It seems that the positioning and animation logic could be isolated from the display. For instance: https://getbootstrap.com/docs/4.5/components/badge/#contextual-variations.
Out of curiosity, what part doesn't it solve? |
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
On this I had a similar thought. I think there is too much opinion baked inside the |
@mbrookes From what I understand, if the component commit twice, we will notice the 0. But IMHO, it's good enough in the current tradeoff :).
Ok cool, there is a Trello item that is dedicated to this problem. It's not directly related to this problem we try to solve, we can discuss it later on. |
Co-authored-by: Olivier Tassinari <olivier.tassinari@gmail.com>
@mnajdova Well done :) |
This PR is fixing the flickering of the badge components, when transitioning to invisible state.
Previously:
(You can see the middle transition - the 0 being applied while it is disappearing)
Now:
The provided solution is based on the prev properties on the Badge component (only the props used in the classes + the content are being considered.
As an alternative I tried using the
SwitchTransition
component fromreact-transition-group
, but the flickering was still there...