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

Difference between Navigator and BottomSheetNavigator APIs #490

Open
rychagovDi opened this issue Sep 22, 2024 · 0 comments
Open

Difference between Navigator and BottomSheetNavigator APIs #490

rychagovDi opened this issue Sep 22, 2024 · 0 comments

Comments

@rychagovDi
Copy link

rychagovDi commented Sep 22, 2024

Hi!

I'm trying to integrate BottomSheet support with BottomSheetNavigator in my app, and I was confused a bit by BottomSheetNavigator API.

BottomSheetNavigator accept any Screen, as regular Navigator does. And for me it means that any screen might be moved from regular navigation stack to bottom sheet without knowing it's opened inside bottom sheet.

But if I want to programmatically close this screen from the inside of it's logic, the difference comes in.

Example:

To close the screen, I use navigator.pop()

If the screen is opened via regular navigation stack, the stack is:

Navigator
- Screen 
- The Screen <- current screen

In this case, calling navigator.pop() checks that our screen is not the last one in the stack, so it gets popped successfully.

But if the screen is opened via bottom sheet, the stack is:

Navigator
- Screen + BottomSheetNavigator
-- Navigator created in BottomSheetNavigator
--- The Screen <- current screen 

In this case, calling navigator.pop() does nothing, as navigator is an another instance (not a root one), so it has it's own stack, which has only one entity - The Screen.

My expectation was: if inner bottom sheet navigator stack has single element, then pop() will hide the bottom sheet itself.

I don't like an idea to pass some flag to the screen like "hey, you're opened inside bottom sheet, so please use another navigation logic"

Can you please give me your thoughts about this? Do you think I misuse BottomSheet API, or expect something incorrect?

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

No branches or pull requests

1 participant