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

fix(Android): separate transitions of sheet and dimming view #2542

Merged
merged 48 commits into from
Jan 31, 2025

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Nov 27, 2024

Description

This PR allows the form sheet on Android to be dismissed using slide-down animation. Currently the sheet fades-out together with the dimming view due to using regular Tween animations, which apply animation whole view hierarchy from the fragment's root view down - this does not allow for separate animations for the sheet and dimming view.

Transition API was considered as an implementation measure, however due to numerous encountered problems, most prominent example being "disappearing shadows during pop transitions", I rejected it.

The implementation settled on using custom value / object evaluators. This approach comes with its own series of issues, with the most prominent one:

  • on old architecture the fragment transaction execution (transition) starts before initial frame for content wrapper is received - I decided to defer the transaction to the moment of receiving the layout.

Caution

This PR changes current default animation for formsheets on Android. This is potentially a breaking change. I haven't decided yet whether to treat is as a fix or hide this new animation behind some prop.

WIP recordings of the changes.

Changes

  • Form Sheet screens use now custom animators instead of tween animation (setCustomTransition) defined in ScreenStack.onUpdate.
  • Removed DimmingFragment as there is no longer "nested fragment strcuture". Dimming view is now attached directly into hierarchy (under coordinator layout) w/o hosting it in separate fragment.
  • Refactored native dismiss code

Note

During testing I've noticed that for some reason the form sheet screens do not receive onWill(dis)appear events on navigator. This is something to investigate, however it seems that this is not a regression.

Test code and steps to reproduce

TestFormSheet / TestAndroidTransitions examples

Checklist

  • Included code example that can be used to test this change
  • Ensured that CI passes

Copy link
Member Author

@kkafar kkafar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Okay, the code changes look good now. I'm gonna drop this in beta of 4.7.0

@kkafar kkafar marked this pull request as ready for review January 31, 2025 11:37
@kkafar kkafar changed the title fix(Android): separate transitions of sheet and dimming view feat(Android): separate transitions of sheet and dimming view Jan 31, 2025
@kkafar kkafar changed the title feat(Android): separate transitions of sheet and dimming view fix(Android): separate transitions of sheet and dimming view Jan 31, 2025
@kkafar kkafar merged commit 89f8ad3 into main Jan 31, 2025
4 checks passed
@kkafar kkafar deleted the @kkafar/separate-transition-for-sheet-and-dimming-view branch January 31, 2025 12:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant