diff --git a/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java b/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java index 06e798f295..7d12757d3f 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java +++ b/android/capacitor/src/main/java/com/getcapacitor/plugin/Modals.java @@ -124,6 +124,7 @@ public void showActions(final PluginCall call) { } final ModalsBottomSheetDialogFragment fragment = new ModalsBottomSheetDialogFragment(); + fragment.setTitle(title); fragment.setOptions(options); fragment.setCancelable(false); fragment.setOnSelectedListener(new ModalsBottomSheetDialogFragment.OnSelectedListener() { diff --git a/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java b/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java index f3ef5b6108..15bb23303d 100644 --- a/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java +++ b/android/capacitor/src/main/java/com/getcapacitor/ui/ModalsBottomSheetDialogFragment.java @@ -28,10 +28,14 @@ public interface OnSelectedListener { void onSelected(int index); } + private String title; private JSArray options; private OnSelectedListener listener; + public void setTitle(String title) { + this.title = title; + } public void setOptions(JSArray options) { this.options = options; } @@ -79,7 +83,11 @@ public void setupDialog(Dialog dialog, int style) { LinearLayout layout = new LinearLayout(getContext()); layout.setOrientation(LinearLayout.VERTICAL); layout.setPadding(layoutPaddingPx16, layoutPaddingPx16, layoutPaddingPx16, layoutPaddingPx16); - + TextView ttv = new TextView(getContext()); + ttv.setTextColor(Color.parseColor("#757575")); + ttv.setPadding(layoutPaddingPx8, layoutPaddingPx8, layoutPaddingPx8, layoutPaddingPx8); + ttv.setText(title); + layout.addView(ttv); try { List optionsList = options.toList(); for (int i = 0; i < optionsList.size(); i++) { diff --git a/core/src/core-plugin-definitions.ts b/core/src/core-plugin-definitions.ts index b3fd0b3115..c33caa48eb 100644 --- a/core/src/core-plugin-definitions.ts +++ b/core/src/core-plugin-definitions.ts @@ -1224,6 +1224,9 @@ export interface ConfirmResult { export interface ActionSheetOptions { title: string; + /** + * iOS only + */ message?: string; options: ActionSheetOption[]; }