I'm building drag'n'drop component for svelte and would like to add animations. I have adapted code from another component, but I cannot make it to work, could you help me pinpoint where the problem is? I don't understand error im getting. here is working REPL
https://svelte.dev/repl/acc2c90db2054d89b210f23c026c525e?version=3.16.7
error shows when I paste:
in:receive={{ key: index }}
out:send={{ key: index }}
animate:flip={{ duration: 300 }}
into line 130 of component in REPL
following error message i get: "An element that use the animate directive must be the immediate child of a keyed each block (132:8)"
i have tried to remove "wrap" div to move animate one as "direct child" of #each but it didnt help
{#if list && list.length}
<div class="cont">
{#each list as item, index}
<div class="wrap">
<div
data-index={index}
id={index}
on:dragstart={() => { return false }}
on:touchstart={handleMousedown}
on:touchmove={handleMousemove}
on:touchend={handleMouseup}
on:mousedown={handleMousedown}
on:mousemove={handleMousemove}
on:mouseover={HandleMouseover}
in:receive={{ key: index }}
out:send={{ key: index }}
animate:flip={{ duration: 300 }}
class="tobedragged {((index == movingIndex) && moving) ? 'ghost' : ''}" style="top: {m.y}px; left: {m.x}px;">
list index: {index}<br>
{item}
<slot {item} {index} />
</div>
</div>
{/each}
</div>
{/if}