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

Error when closing component: close is not a function #420

Open
mikfaina opened this issue Jan 31, 2023 · 1 comment
Open

Error when closing component: close is not a function #420

mikfaina opened this issue Jan 31, 2023 · 1 comment

Comments

@mikfaina
Copy link

I'm trying to close a zoidComponent (to reopen it after) but I get an error
Function to create zoid component:

function zoidPopup(params) {

    return zoid.create({
        tag: params.tag,
        url: params.url,
        dimensions: {
            width: '1200px',
            height: '600px',
        },
        scrolling: false,
        props: {
            save: {
                type: "function",
                required: false,
            },
        },
    });
}

Instantiate and render component:

        this.popUpInstance = zoidPopup({tag: this.#config.tag + '-popUp', url: props.url + '?tag=' + this.#config.tag + '-popUp'})
        this.popUpInstance({
            save: props.save
        }).render("#popupWindow")

Closing component:

if (this.popUpInstance) {
            this.popUpInstance.close()
}

And I get this error:
script.js?bust=1675155705719:122 Uncaught TypeError: this.popUpInstance.close is not a function

Inside the this.popUpInstance when I call the close function I have this:
image

Any idea?

Thanks

@bluepnume
Copy link
Collaborator

bluepnume commented Jan 31, 2023

Try this:

this.component = zoidPopup({tag: this.#config.tag + '-popUp', url: props.url + '?tag=' + this.#config.tag + '-popUp'})

this.popUpInstance = this.component({
    save: props.save
})

this.popUpInstance.render("#popupWindow");

this.popUpInstance.close();

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