Skip to content

Commit 6c75e45

Browse files
authored
Merge pull request #329 from vallemar/master
feat(BottomSheet): add suport dismissOnBackButton
2 parents f4a1760 + 6e4b49a commit 6c75e45

File tree

2 files changed

+5
-0
lines changed

2 files changed

+5
-0
lines changed

src/bottomsheet/bottomsheet-common.ts

+1
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface BottomSheetOptions {
2323
animated?: boolean; // An optional parameter specifying whether to show the sheet view with animation.
2424
dismissOnBackgroundTap?: boolean; // An optional parameter specifying whether to dismiss the sheet when clicking on background.
2525
dismissOnDraggingDownSheet?: boolean; // An optional parameter specifying whether to disable dragging the sheet to dismiss.
26+
dismissOnBackButton?: boolean; // An optional parameter that specifies whether to close the sheet when pressing the back button.
2627
closeCallback?: Function; // A function that will be called when the view is closed. Any arguments provided when calling shownInBottomSheet.closeCallback will be available here.
2728
trackingScrollView?: string; // optional id of the scroll view to track
2829
transparent?: boolean; // optional parameter to make the bottomsheet transparent

src/bottomsheet/bottomsheet.android.ts

+4
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ export class ViewWithBottomSheet extends ViewWithBottomSheetBase {
5151
},
5252

5353
onBackPressed(dialog: com.nativescript.material.bottomsheet.BottomSheetDialog) {
54+
if(bottomSheetOptions.options && bottomSheetOptions.options.dismissOnBackButton === false){
55+
return true;
56+
}
57+
5458
if (!owner) {
5559
return false;
5660
}

0 commit comments

Comments
 (0)