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

feat: @capacitor/action-sheet - allow click-outside and back-button on ActionSheet on Android #2154

Open
funkyvisions opened this issue Jul 17, 2024 · 1 comment
Labels
platform: android type: feature request A new feature, enhancement, or improvement

Comments

@funkyvisions
Copy link

funkyvisions commented Jul 17, 2024

Feature Request

Plugin

action-sheet

Description

Would be nice if tapping outside of the ActionSheet or using the hardware/software back button would close the ActionSheet.

Platform(s)

Android

Preferred Solution

Add the following to ActionSheetPlugin.java

Change

implementation.setCancelable(false);

to

           implementation.setCancelable(true);
           implementation.setOnCancelListener(() -> {
               implementation.dismiss();
               JSObject ret = new JSObject();
               ret.put("index", -1);
               call.resolve(ret);
           });

Alternatives

None

Additional Context

None

@funkyvisions
Copy link
Author

I also discovered on iOS for iPad that you need to do this inside of ActionSheetPlugin.swift

         var alertActions = [UIAlertAction]()
+        alertActions.append(UIAlertAction(title: "", style: .cancel, handler: {(_) -> Void in call.resolve(["index": -1])}))

@alexgerardojacinto alexgerardojacinto added the type: feature request A new feature, enhancement, or improvement label Jul 30, 2024
@alexgerardojacinto alexgerardojacinto changed the title Allow click-outside and back-button on ActionSheet on Android feat: @capacitor/action-sheet - allow click-outside and back-button on ActionSheet on Android Jul 30, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
platform: android type: feature request A new feature, enhancement, or improvement
Projects
None yet
Development

No branches or pull requests

3 participants