Add entered
prop to Transition components
#504
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR will allow you to add an additional
entered
prop with a bunch of classes. This prop contains all the classes that you want to make sure that exist when the transitions are done.E.g.:
If we don't have this then the
opacity-75
would be gone after it is done transitioning. This will result in a full opaque background.Can't we solve this already:
Yes, there are some situations where it is doable to solve these kind of problems. For example you can transition from
opacity-0
toopacity-100
and keep abg-opacity-75
always applied. But this doesn't work for other utilities.Can't you keep the classes that exist before transitioning, and make sure they are applied once everything is done?
Yes, but there is an issue. If you enter from
opacity-0
and enter toopacity-75
, and by default your className containsopacity-75
, then there is a moment in time thatopacity-0
andopacity-75
are applied at the exact same time. This might work, but it's better not to rely on the same utility kind of class to be applied at the exact same time.Why don't we just apply the
enterTo
once it is done?This will work in a lot of cases, but it won't once your
enterTo
andleaveFrom
are different.Here is a small video showcasing what this feature does:
Screen.Recording.2021-05-11.at.13.24.33.mov