You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?
The text was updated successfully, but these errors were encountered:
Hi!
I'm trying to integrate BottomSheet support with
BottomSheetNavigator
in my app, and I was confused a bit byBottomSheetNavigator
API.BottomSheetNavigator
accept anyScreen
, as regularNavigator
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:
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:
In this case, calling
navigator.pop()
does nothing, asnavigator
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?
The text was updated successfully, but these errors were encountered: