We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
const handleDragEnd = useCallback( event => { const {active, over} = event;
setTimeout(() => { const allItems = document.querySelectorAll('.MageplazaTT-MediaItem__Container'); allItems.forEach(item => item.classList.remove('Warning__Box')); allItems.forEach(item => item.classList.remove('Position__Media')); }, 0); if (active.id !== over.id) { setActiveId(over.id); const oldIndex = tempMediaList.findIndex(item => item.mediaId === active.id); const newIndex = tempMediaList.findIndex(item => item.mediaId === over.id); const activeItem = tempMediaList[oldIndex]; const overItem = tempMediaList[newIndex]; if (activeItem.mediaPined === overItem.mediaPined) { const dataSort = [ { index: oldIndex, timestamp: tempMediaList[oldIndex].timestamp, id: tempMediaList[oldIndex].mediaId }, { index: newIndex, timestamp: tempMediaList[newIndex].timestamp, id: tempMediaList[newIndex].mediaId } ]; handleAction({ action: ACTION_REARRAGE, data: {dataSort: dataSort} }); } else { setTempMediaList(mediaList); } } }, [handleAction, tempMediaList]
);
const SortableGallery = ({items, activeId}) => { return (
item-${index}
The text was updated successfully, but these errors were encountered:
See if setting your <SortablePhoto key={item-${index}} index={index} photo={item} /> component key to a stable (non index based) key helps.
<SortablePhoto key={item-${index}} index={index} photo={item} />
You can try <SortablePhoto key={item.mediaId} index={index} photo={item} />
<SortablePhoto key={item.mediaId} index={index} photo={item} />
Sorry, something went wrong.
No branches or pull requests
const handleDragEnd = useCallback(
event => {
const {active, over} = event;
);
const SortableGallery = ({items, activeId}) => {
return (
<SortableContext items={items.map(item => item.mediaId)} strategy={rectSortingStrategy}>
{items.map((item, index) => (
<SortablePhoto key={
item-${index}
} index={index} photo={item} />))}
<div style={{background: 'red'}}>
<DragOverlay
dropAnimation={{
duration: 2000
}}
>
{activeId ? : null}
);
};
my overlay return to its start position after releasing the dragged item. please check it.
The text was updated successfully, but these errors were encountered: