MCPcopy
hub / github.com/adobe/react-spectrum / beginDragging

Function beginDragging

packages/react-aria/src/dnd/DragManager.ts:82–100  ·  view source on GitHub ↗
(target: DragTarget, stringFormatter: LocalizedStringFormatter)

Source from the content-addressed store, hash-verified

80}
81
82export function beginDragging(target: DragTarget, stringFormatter: LocalizedStringFormatter): void {
83 if (dragSession) {
84 throw new Error('Cannot begin dragging while already dragging');
85 }
86
87 dragSession = new DragSession(target, stringFormatter);
88 requestAnimationFrame(() => {
89 if (dragSession) {
90 dragSession.setup();
91 if (getDragModality() === 'keyboard') {
92 dragSession.next();
93 }
94 }
95 });
96
97 for (let cb of subscriptions) {
98 cb();
99 }
100}
101
102export function useDragSession(): DragSession | null {
103 let [session, setSession] = useState(dragSession);

Callers

nothing calls this directly

Calls 4

getDragModalityFunction · 0.90
cbFunction · 0.85
nextMethod · 0.80
setupMethod · 0.45

Tested by

no test coverage detected