Skip to content

fix(Android): prevent crash by properly managing lifecycle of the dimming view #2750

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

Merged
merged 2 commits into from
Feb 27, 2025

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Feb 27, 2025

Description

When we have a formSheet on Android & we navigate to regular push screen on top of it & we go back navigation.goBack()
the app will crash.
This is because the ScreenStackFragment' view will be recreated, but it will reuse existing dimming view, leading to a crash when
inserting this dimming view to a coordinator, because no one never cleared previous parent of it.

Changes

See the code, basically I've ensured that the previous dimming view is invalidated & on fragment view recreation (when it is reattached)
new dimming view is created.

Test code and steps to reproduce

TestFormSheet

  1. Open sheet
  2. Navigate to second
  3. Go back
  4. In this very moment app crashes

Checklist

@kkafar kkafar merged commit b399879 into main Feb 27, 2025
3 of 4 checks passed
@kkafar kkafar deleted the @kkafar/android-crash-formsheet-goback branch February 27, 2025 16:57
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