Skip to content

feat(BottomSheet): add suport dismissOnBackButton #329

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

Merged
merged 4 commits into from
Sep 19, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/bottomsheet/bottomsheet-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ export interface BottomSheetOptions {
animated?: boolean; // An optional parameter specifying whether to show the sheet view with animation.
dismissOnBackgroundTap?: boolean; // An optional parameter specifying whether to dismiss the sheet when clicking on background.
dismissOnDraggingDownSheet?: boolean; // An optional parameter specifying whether to disable dragging the sheet to dismiss.
dismissOnBackButton?: boolean; // An optional parameter that specifies whether to close the sheet when pressing the back button.
closeCallback?: Function; // A function that will be called when the view is closed. Any arguments provided when calling shownInBottomSheet.closeCallback will be available here.
trackingScrollView?: string; // optional id of the scroll view to track
transparent?: boolean; // optional parameter to make the bottomsheet transparent
Expand Down
4 changes: 4 additions & 0 deletions src/bottomsheet/bottomsheet.android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,10 @@ export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
},

onBackPressed(dialog: com.nativescript.material.bottomsheet.BottomSheetDialog) {
if(bottomSheetOptions.options && bottomSheetOptions.options.dismissOnBackButton === false){
return true;
}

if (!owner) {
return false;
}
Expand Down