Closed bllfrnch closed 3 years ago
Thanks for reporting. That's odd. Can you confirm that you're seeing a custom close button in the live demo? https://svelte.dev/repl/033e824fad0a4e34907666e7196caec4?version=3.20.1 (Please click on the Show a customized popup and listen to events!)
I looked at your code and can't find an obvious issue. Could you do me a favor and recreate the issue in https://svelte.dev/repl/ or does the issue only happen locally?
I had another look at your repo and noticed that you're using a pretty old version of Svelte. Please try again with a more current version like >=3.20.x
because SvelteComponent.isPrototypeOf(component)
doesn't work with older version of Svelte.
I just tested the Modal. It turns out you need at least v3.19
to use the custom close button. SvelteComponent.isPrototypeOf
isn't available or doesn't work before that. I'll update the README.md accordingly.
Thanks for your reply – I updated the forked repo referenced above to Svelte 3.28.0, and am still not seeing the custom close button.
And here's the same issue demonstrated in the Svelte REPL: https://svelte.dev/repl/33534e6a14864bd09d33318d36988626?version=3.28.0
Found the issue.
You have to open the modal like so:
open(Thing,{}, { closeButton: CloseButton });
Also, you can import a npm package in the repl like so:
import Modal from 'svelte-simple-modal'
Good catch @Yahatix! The first argument of open
is the modal component, the second argument are the modal component props, and the third argument are options.
Hello! I've tried overriding closeButton on a project I'm working. In the debugger, I see it get passed in, but the default close button is still shown. I created a repo (forked from https://github.com/mvolkmann/svelte-ssr) to illustrate the issue; looks like neither client nor server code is working properly (and also not sure why there'd be a difference to begin with). You can see the issue here: https://github.com/bllfrnch/svelte-simple-modal-close-button
Follow instructions for building on client or server, and note the modal that's displayed on clicking the button still shows the default close button.
Thanks for all your hard work!