Skip to content

Conversation

OS-pedrogustavobilro
Copy link
Contributor

The actionSheet prompt was previously not cancellable in Web, even though it is cancellable

  • on Android - setCancelable(false) not called, by default it is cancelable
  • and on iOS - UIAlertAction with style cancel allows sheet to be canceled when clicking outside.

This PR fixes that.

Addresses #2241 and ionic-team/pwa-elements#134

@jcesarmobile
Copy link
Member

The reason why it's not cancelable on web is because pwa-elements action sheet doesn't provide any event to indicate the cancelation, so allowing to cancel the action sheet will make the camera plugin call to hang as it won't reject nor resolve.

So for making the prompt cancelable, pwa-elements action sheet should be updated to emit an event on the cancellation and in camera plugin listen for that event to reject the call with an error as iOS and Android do.

@OS-pedrogustavobilro
Copy link
Contributor Author

OS-pedrogustavobilro commented Dec 17, 2024

@jcesarmobile -> opened a PR for pwa-elements to add an event listener for when the action sheet is dismissed - ionic-team/pwa-elements#138

Then, in this PR, will add the equivalent cancelation that's already present on native Android and iOS.

actionSheet.addEventListener('onCanceled', async () => {
    reject(new CapacitorException('User cancelled photos app'));
})

@co-dax

This comment was marked as abuse.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants