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): missing transition events with formSheet presentation #2682

Merged
merged 1 commit into from
Feb 11, 2025

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Feb 11, 2025

Description

This PR aligns* events received in element tree between Android and iOS for screens with presentation: 'formSheet'.

* almost aligns - on iOS when natively dismissed onDismissed and onDisappear/transitionEnd will be received, whereas on Android it will be only onDismissed for now.
Adding support for onDisappear/transitionEnd requires wider changes in logic which I don't want in incoming 4.7.0 release.

Changes

formSheet animations based on custom animators now have listener set, which emmits appropriate events bypassing "regular" view emitting infrastructure.
I've found that ScreenFragment.onViewAnimation{Start,End} methods do not work for some reason (isResumed is false for form sheet) with the sheets, therefore I bypassed it for now.

Test code and steps to reproduce

TestAndroidTransition + add logs in NativeStackView in react-navigation to see when events are received (or attach appropriate listeners).

Checklist

  • 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.

Notes for future me

fun dispatchOnDismissed() =
reactEventDispatcher?.dispatchEvent(ScreenDismissedEvent(reactSurfaceId, screen.id))

fun dispatchTransitionProgress(progress: Float, isExitAnimation: Boolean, isGoingForward: Boolean) {
Copy link
Member Author

Choose a reason for hiding this comment

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

Not entirely sure of isGoingForward semantics here. This is something to retrospect later.

Copy link
Member Author

Choose a reason for hiding this comment

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

Created ticket on board for this

@kkafar kkafar merged commit 2ca38af into main Feb 11, 2025
4 checks passed
@kkafar kkafar deleted the @kkafar/missing-animation-events-android branch February 11, 2025 13:42
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