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: SystemNavigator.pop respects PopScope(canPop: true) #122

Closed
wants to merge 1 commit into from

Conversation

furaiev
Copy link
Contributor

@furaiev furaiev commented Apr 11, 2024

Status

READY

Breaking Changes

NO

Description

This PR fixes 1st page in the Flow SystemNavigator.pop for Android.
During migration from WillPopScope to PopScope (v.0.1.0) there was missed a bug that reproduces on Androids SystemNavigator.pop:

  • push the Flow with only one page in the stack that contains PopScope(canPop: true)
  • call SystemNavigator.pop
  • the screen is empty (Flow is in the stack, but flow doesn't have pages)

Proposed fix:

  • call _navigator?.pop(); to call onPopInvoked
  • then call Navigator.of(context).maybePop() for real navigation as in previous version of the package

This fix doesn't look like ideal, but it works and I haven't find other way to call onPopInvoked.

Type of Change

  • ✨ New feature (non-breaking change which adds functionality)
  • 🛠️ Bug fix (non-breaking change which fixes an issue)
  • ❌ Breaking change (fix or feature that would cause existing functionality to change)
  • 🧹 Code refactor
  • ✅ Build configuration change
  • 📝 Documentation
  • 🗑️ Chore
  • 🧪 Testing

@furaiev furaiev requested a review from felangel as a code owner April 11, 2024 21:24
if (mounted && !_canPop) _navigator?.pop();
if (mounted && !_canPop) {
// call onPopInvoked if any
_navigator?.pop();
Copy link
Owner

Choose a reason for hiding this comment

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

Can we add a test for this?

@felangel felangel added the bug Something isn't working label Apr 20, 2024
@felangel
Copy link
Owner

@furaiev can you share a minimal reproduction sample? I tried to reproduce but was not able using the example app by wrapping the first page in the onboarding flow with a PopScope and using the system back button on Android.

@furaiev
Copy link
Contributor Author

furaiev commented May 17, 2024

@felangel you are correct. I can not reproduce this in example, it looks like something with my configuration. Will check, thank you!

@furaiev furaiev closed this May 17, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants