Fix Transition events

In Svelte the component updates/unmount happen in a different order than in React. The `mounted` guard doesn't work in Svelte and needs a different approach.
This commit is contained in:
Ryan Gossiaux
2021-12-18 15:41:18 -08:00
parent 2d6bd4658e
commit 2c8be5047d
2 changed files with 25 additions and 8 deletions

View File

@@ -10,11 +10,23 @@
</script>
{#if !hasTransition && hasOpen}
<TransitionRoot {...$$props}>
<TransitionRoot
{...$$props}
on:afterEnter
on:afterLeave
on:beforeEnter
on:beforeLeave
>
<slot />
</TransitionRoot>
{:else}
<TransitionChild {...$$props}>
<TransitionChild
{...$$props}
on:afterEnter
on:afterLeave
on:beforeEnter
on:beforeLeave
>
<slot />
</TransitionChild>
{/if}