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

bug: Modals Plugin: alert on iOS should wait to execute callback until the modal is closed #2079

Closed
1 of 4 tasks
Justin-Credible opened this issue Oct 22, 2019 · 1 comment · Fixed by #2080
Closed
1 of 4 tasks

Comments

@Justin-Credible
Copy link
Contributor

Justin-Credible commented Oct 22, 2019

Bug Report

Capacitor Version

1.2.1

npx cap doctor output:

💊   Capacitor Doctor  💊 

Latest Dependencies:

  @capacitor/cli: 1.2.1

  @capacitor/core: 1.2.1

  @capacitor/android: 1.2.1

  @capacitor/ios: 1.2.1

Installed Dependencies:

  @capacitor/cli 1.2.1

  @capacitor/core 1.2.1

  @capacitor/ios 1.2.1

  @capacitor/android 1.2.1


[success] Android looking great! 👌

Affected Platform(s)

  • Android
  • iOS
  • Electron
  • Web

Current Behavior

The alert method of the modals plugin executes the callback immediately, before the user has closed the modal. This is problematic for code that is awaiting on the promise to be resolved, expecting it to be resolved only after the user closes the modal.

async showAlert() {
  let alertRet = await Modals.alert({
    title: 'Stop',
    message: 'this is an error'
  });
  console.debug("After modal call hit!");
}

You can see this behavior using the example code from the documentation, by simply adding a console logging statement. You'll see the log statement executes immediately, even before the user closes the modal.

This is only a problem on iOS. On Android the log statement does not fire until the user dismisses the modal.

Expected Behavior

The console log statement should not execute until the user dismisses the modal.

Sample Code or Sample Application Repo

async showAlert() {
  let alertRet = await Modals.alert({
    title: 'Stop',
    message: 'this is an error'
  });
  console.debug("After modal call hit!");
}
@ionitron-bot
Copy link

ionitron-bot bot commented Nov 13, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Capacitor, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Nov 13, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant