react-beautiful-dnd

How to implement drag and drop behaviour in React

感情迁移 提交于 2020-01-04 04:10:10
问题 I'm trying to implement drag and drop behaviour using React and react-beautiful-dnd library. I want to chose some images using react-dropzone library and after choosing images I show thumbnails on the right side of the screen and after that I want to be able to drag one of those thumbnails to the left side and drop it to one of those containers. My code is as follows: import React, { Component } from "react"; import ReactDOM from "react-dom"; import { DragDropContext, Droppable, Draggable }

Strange behavior when dragging items on the second drag react-beautiful-dnd

谁说我不能喝 提交于 2019-12-23 03:49:09
问题 For some reason every second drag is not performing very well when using the react-beautiful-dnd package (see image) my onDragEnd function is looking like this: const onDragEnd = result => { if (!result.destination) { return; } if ( result.destination.droppableId === result.source.droppableId && result.destination.index === result.source.index ) { return; } const draggedItem = list[result.source.index]; list.splice(result.source.index, 1); list.splice(result.destination.index, 0, draggedItem)

Getting Error : find drag handle element inside of Draggable when adding isDragDisabled flag in draggable

☆樱花仙子☆ 提交于 2019-12-13 19:42:40
问题 When I set isDragDisabled to true (hard coded) I am getting an error like this index.js:1446 raw Error: Invariant failed: Cannot find drag handle element inside of Draggable. Please be sure to apply the {...provided.dragHandleProps} to your Draggable My draggable component is class Task extends Component { render() { console.log("taskID: ", this.props.task.id, this.props.task.id === 1) return ( <Draggable draggableId={this.props.task.id} index={this.props.index} isDragDisabled={true} > {

Strange behavior when dragging items on the second drag react-beautiful-dnd

久未见 提交于 2019-12-06 16:01:35
For some reason every second drag is not performing very well when using the react-beautiful-dnd package (see image) my onDragEnd function is looking like this: const onDragEnd = result => { if (!result.destination) { return; } if ( result.destination.droppableId === result.source.droppableId && result.destination.index === result.source.index ) { return; } const draggedItem = list[result.source.index]; list.splice(result.source.index, 1); list.splice(result.destination.index, 0, draggedItem); /** Firebase update */ dbCon.once('value', function(snapshot) { snapshot.forEach(function(child) {