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

iOS: problem with programmatically close the dialog #33

Open
cristiandaulisio opened this issue May 4, 2020 · 8 comments
Open

iOS: problem with programmatically close the dialog #33

cristiandaulisio opened this issue May 4, 2020 · 8 comments

Comments

@cristiandaulisio
Copy link

Which platform(s) does your issue occur on?

  • iOS 13
  • iPhone 7

I'm using this plugin for iOS. All work fine, except that when I want programmatically close the dialog.

If I call "dismiss" the dialog close, but the app freeze, while if I click on the dialog button close all work fine. Need to declare something else?

Thanks

@shiv19
Copy link
Owner

shiv19 commented May 4, 2020

Can you show me the code of how you are dismissing the alert?
At what point in the code?

@cristiandaulisio
Copy link
Author

Ty for fast answer

let cfalertDialog = new CFAlertDialog();
let config: {..}
cfalertDialog.show(config);
cfalertDialog.dismiss();

The dialog go away but something go wrong with the app, while if I click on cancel it is all ok.

@cristiandaulisio
Copy link
Author

cristiandaulisio commented May 4, 2020

Well I think is better If I paste the full code:

`public CreateConfirm(options: any): Promise<boolean>
    {
        return new Promise((resolve, reject) =>
        {
            
                let cfalertDialog = new CFAlertDialog();
 
                let config: DialogOptions = {
                    // Options go here
                    dialogStyle: CFAlertStyle.ALERT,
                    title: options.title,
                    message: options.message,
                    cancellable: false,
                    onDismiss: function (dialog) {
                        resolve(false)
                    },
                    buttons: [{
                        text: "INVIA", // title
                        buttonStyle: CFAlertActionStyle.POSITIVE,
                        buttonAlignment: CFAlertActionAlignment.JUSTIFIED,
                        onClick: function ()
                        {
                            resolve(true);
                        }
                            
                    },{
                        text: "ANNULLA", // title
                        buttonStyle: CFAlertActionStyle.DEFAULT,
                        buttonAlignment: CFAlertActionAlignment.JUSTIFIED,
                        onClick: function ()
                        { 
                            resolve(false);
                        }
                    }]
                    }
 
                cfalertDialog.show(config); 
                this.dialog = cfalertDialog;
            
        });
    }
    
    public Close(): Promise<boolean>
    {
        return new Promise(async(resolve, reject) =>
{
            if (this.dialog !== null)
            {
            
                this.dialog.dismiss();
                this.dialog = null;
            }
            
            resolve(true);
        });
    }`

@cristiandaulisio
Copy link
Author

cristiandaulisio commented May 4, 2020

Other infos that can be useful:

result = await this.DialogResume();
console.log("Action on dialog);
public async DialogResume(): Promise<boolean>
{
const result = this._lastDialog.CreateConfirm({
            title: "This is the title"
            message: "This is the message"
        });
        return result;
}

I notice that I receive this exception:
Unbalanced calls to begin/end appearance transitions for <UIViewControllerImpl: 0x15dea9ae0>.

@cristiandaulisio
Copy link
Author

update: if i write this.dialog.dismiss(true); it work!

@shiv19
Copy link
Owner

shiv19 commented May 5, 2020

@Atomico001
Yes, it mentioned in the readme that the dismiss function takes a boolean as the parameter. And it doesn't have a default value in the code.
You have to pass a boolean to it.

@cristiandaulisio
Copy link
Author

Hi @shiv19 i was trying all time with this.dialog.dismiss(false); and it didn't worked. Only with true work.

@shiv19
Copy link
Owner

shiv19 commented May 5, 2020

That is weird! Thanks for reporting this :)

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

No branches or pull requests

2 participants