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: invalid dismissCount value when closing modals #1531

Merged
merged 4 commits into from
Jul 18, 2022
Merged

Conversation

kkafar
Copy link
Member

@kkafar kkafar commented Jul 18, 2022

Description

Fixes #1473

When modals are pushed onto the stack, in view hierarchy they end up not being descendants of RNSScreenNavigationController -> When a modal is dismissed & we ask RNSScreen with modal view for its navigation controller ([self navigationController]) we receive null. This caused getIndexOfView: method to return -1 (as the view was not found) what resulted in wrong value of _dismissCount.

Changes

Added a check for case when navigationController of RNSScreen is null - now in such case we default to _dismissCount == 1

Screenshots / GIFs

Before

Screen.Recording.2022-07-18.at.12.47.41.mov

After

Screen.Recording.2022-07-18.at.12.46.22.mov

Test code and steps to reproduce

Test1473 in test example apps.

Checklist

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

@kkafar kkafar requested a review from WoLewicki July 18, 2022 10:48
@kkafar kkafar marked this pull request as ready for review July 18, 2022 10:49
Copy link
Member

@WoLewicki WoLewicki left a comment

Choose a reason for hiding this comment

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

LGTM! 🎉

@kkafar kkafar merged commit ac4d780 into main Jul 18, 2022
@kkafar kkafar deleted the @kkafar/fix-1473 branch July 18, 2022 13:13
@hirbod
Copy link
Contributor

hirbod commented Jul 25, 2022

Thanks you very much for fixing this, even though I did not provide a repro!

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.

Pressing on Modal Background causing navigation to pop two routes.
3 participants