Possibility of trigger eventCallback 'onStart' or setState 'dragging' of Draggable JSX-element?

Open
#637 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
5/5
Estimated time
Over a week
Newbie friendliness
25/100
Issue type
Feature
Clarity
Needs clarification
Activity status
Stale
Tech stack
javascript, react
Domain
frontend

Research direction

The issue names the Draggable JSX element, its onStart prop, and internal dragging state, but no repository files or tests. Start by locating the Draggable component and tracing how mounting and drag-start are handled; done means an agreed supported path for creating the card at the cursor and retaining or removing it after drop.

Written by the indexing model from the issue text.

Description

The situation
I want to generate a new component (a new card) over some drag-and-drop-function.
The plan: If the user start to drag from a button at the sidebar, a new draggable component should appear at his cursor. If he drop this component at a drop-zone, the component should be stay at that point. At other zones the component disappear.

And before you ask: To use the cursor-css-styles cannot work for me, they block all other mouse-events. They are important to adjust the new card.

The plan
The dragging-action is already in progress when the Draggable-component is mounted. She cannot trigger the onStart={} event by her own.

Because of this problem I search for a way to trigger the synthetic event onStart={} manually. What a real challenge is there is no way to get the JSX-element from the DOM. At least I didn't find any. Another way would be to modify the dragging-state from the Draggable component:

dragged:true
dragging:false
isElementSVG:false
prevPropsPosition:{x: 0, y: 0}
slackX:0
slackY:0
x:0
y:0

To add the class react-draggable-dragging did not work, i tried it already.

The question
Is there a way to set the dragging-state manually? Or is there a way I didn't see to bind the element at the cursor, directly after mounting?

Dominant language
JavaScript
Stars
9.3k
Forks
1k
Avg merge
3d 8h
Merged PRs (30d)
4

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from react-grid-layout/react-draggable

All issues in react-grid-layout/react-draggable

Similar issues

More JavaScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.