-
Notifications
You must be signed in to change notification settings - Fork 98
Implement enter end exit animation for Dialog #2374
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
base: jb-main
Are you sure you want to change the base?
Conversation
I'm not sure this is a good idea, in several aspects:
|
Customization is key! There should be a default value trying to mimic platform behaviour (per Os and platform like IOS, MacOs, Windows, etc) but it should still be customizable on dev's side |
@m-sasha , thanks for the feedback. If you have any ideas how to organize the API, please let me know.
As animation is a behaviour defined by the platform itself, it seems reasonable to define the basic animation in the 'ui' module. However, there are caveats, which I will explain further in the text.
It's good that you raised this question. To answer it, we must consider that a Popup is not equivalent to an Alert Dialog (or UIAlertController on iOS) — it can be used for a much wider range of use-cases. For this reason, I don't think we need to copy all the Alert Dialog animation variations for all the platforms and their various versions. It's much better to add a common wrapper around the system controls to have the native alerts than to mimic their behaviour.
On Android they are using Compose code to draw the Dialog's content and platform-provided scrim/appearance animations.
I don't have a strong opinion on that; it's a question for the designers. What I am sure about is that we should not blindly copy the alert animation as the dialog animation.
Until we have design opinion, I'd go with the one used on Android. |
@ApoloApps , please read my comment to @m-sasha . Dialogs can also be used for UI like this. I don't think they should have the same animation as alerts. |
*/ | ||
@ExperimentalComposeUiApi | ||
@Immutable | ||
interface DialogAnimationScope { |
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 don't think it's a good idea to introduce such API not in commonMain
. My suggestion: introduce android-like animation for now in fork, but do NOT introduce such API for configuring in skikoMain
. Instead we can start the thread with Google folks to add this in common in future.
We can still add another boolean flag to DialogProperties
just to disable animation for compatibility purposes
|
||
/** | ||
* The default scrim opacity. | ||
*/ | ||
private const val DefaultScrimOpacity = 0.6f | ||
private const val DefaultScrimOpacity = 0.78f |
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.
Please revert default value here - it's picked from Android OS sources. It should be the same by default across the platforms
Implement enter end exit animation for Dialog that matches the latest Android animation.
Animation
Android:
Screen.Recording.2025-09-01.at.16.03.32.mov
iOS:
Simulator.Screen.Recording.-.iPhone.16.-.2025-09-01.at.15.57.56.mp4
Desktop:
Screen.Recording.2025-09-01.at.15.59.01.mov
Fixes https://youtrack.jetbrains.com/issue/CMP-4365/iOS-iOS-Dialog-has-no-enter-and-exit-animation
Release Notes
Features - Multiple Platforms