isDragging
See original GitHub issueHi, I’m having problem with isDragging
- it stays on original position instead of moving with dragged element (red border). This probably is not a bug, just me not knowing how this works.
I’m updating data via flux, doing nothing with isDragging
.
http://fluid.cz/projects/react-dnd/
http://fluid.cz/projects/react-dnd/code.zip
Thanks for help
Issue Analytics
- State:
- Created 9 years ago
- Comments:6 (3 by maintainers)
Top Results From Across the Web
isDragging | Apple Developer Documentation
isDragging. A Boolean value that indicates whether the user has begun scrolling the content. iOS 2.0+ iPadOS 2.0+ Mac Catalyst 13.0+ tvOS 9.0+ ......
Read more >DraggableStateSnapshot.isDragging - Javascript - Tabnine
Best JavaScript code snippets using react-beautiful-dnd.DraggableStateSnapshot.isDragging(Showing top 15 results out of 315).
Read more >DragSourceMonitor - React DnD
isDragging () : Returns true if a drag operation is in progress, and either the owner initiated the drag, or its isDragging() is...
Read more >useDrag method of react-dnd , cannot get isDragging in ...
Got the answer from react-dnd TSX example. sandbox url const [{ isDragging }, drag] = useDrag({ type: "image", item: () => { return...
Read more >Dragging Over An Element Without Triggering Hover State
isDragging () to set the isDragging state use !!monitor.getItem() , like so: const [{ opacity, isDragging } ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh, I see your point now. The problem in your example is fixed by giving your items a unique
key
each. (It may be some global ID, just not the index.) There’s a warning in console about that. If you give themkey
s, React will move the original component, soisDragging
will be relevant.It’s not perfect we can’t handle the situation gracefully without keys. This will be a good stress case for whatever API we implement in #64 but we don’t support this yet.
isDragging
only reflects the state of dragging. The item won’t move “by itself” because we’re not touching the DOM in React DnD—we’re letting you do it.You have two options:
isDragging
istrue
by either returningnull
fromrender
or usingopacity: 0
. Sortable example covers this technique.Hope it helps!