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

Android: Is there any way to allow touching outside the BottomSheet without closing the bottomsheet! Is it possible to behave like standard sheet and not like a modal sheet #404

Open
Frizbi22 opened this issue Nov 27, 2023 · 2 comments
Labels
help wanted Extra attention is needed question Further information is requested

Comments

@Frizbi22
Copy link

   I have tried this but no luck!!
   
    var bottomSheetDialog = new BottomSheetDialog(Platform.CurrentActivity?.Window?.DecorView.FindViewById(Android.Resource.Id.Content)?.Context ?? throw new InvalidOperationException("Context is null"));
    bottomSheetDialog.SetContentView(bottomSheetContent.ToPlatform(page.Handler?.MauiContext ?? throw new Exception("MauiContext is null")));


    // Allow touches on the underlying page
    bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotTouchable);
    bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.DimBehind);
    bottomSheetDialog.Window?.ClearFlags(WindowManagerFlags.NotFocusable);

    // Set the behavior of the bottom sheet
    bottomSheetDialog.Behavior.Hideable = true;
    bottomSheetDialog.Behavior.FitToContents = true;
    bottomSheetDialog.SetCancelable(true);
    bottomSheetDialog.Behavior.HalfExpandedRatio = 0.5f;

    bottomSheetDialog.Show();
    return bottomSheetDialog;
    
    on iOS is working as intended when using medium or large detents!
@Frizbi22 Frizbi22 changed the title Is there any way to allow touching outside the BottomSheet without closing the it! Android: Is there any way to allow touching outside the BottomSheet without closing the bottomsheet! Nov 27, 2023
@Frizbi22 Frizbi22 changed the title Android: Is there any way to allow touching outside the BottomSheet without closing the bottomsheet! Android: Is there any way to allow touching outside the BottomSheet without closing the bottomsheet! Is it possible to behave like standard sheet and not like a modal sheet Nov 28, 2023
@VladislavAntonyuk
Copy link
Owner

Probably this flag should be false: bottomSheetDialog.Behavior.Hideable

@Frizbi22
Copy link
Author

Frizbi22 commented Feb 1, 2024

I have tried that but bottomSheetDialog.Behavior.Hideable is a property that determines whether the bottom sheet is responsive to drag gestures. Sadly i found no solution for it

@VladislavAntonyuk VladislavAntonyuk added help wanted Extra attention is needed question Further information is requested labels Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed question Further information is requested
Projects
None yet
Development

No branches or pull requests

2 participants