MCPcopy Create free account
hub / github.com/adobe/react-spectrum / updateDragging

Function updateDragging

packages/react-stately/src/slider/useSliderState.ts:310–326  ·  view source on GitHub ↗
(index: number, dragging: boolean)

Source from the content-addressed store, hash-verified

308 }
309
310 function updateDragging(index: number, dragging: boolean) {
311 if (isDisabled || !isThumbEditable(index)) {
312 return;
313 }
314 if (dragging) {
315 valuesRef.current = values;
316 }
317
318 const wasDragging = isDraggingsRef.current[index];
319 isDraggingsRef.current = replaceIndex(isDraggingsRef.current, index, dragging);
320 setDraggings(isDraggingsRef.current);
321
322 // Call onChangeEnd if no handles are dragging.
323 if (onChangeEnd && wasDragging && !isDraggingsRef.current.some(Boolean)) {
324 onChangeEnd(valuesRef.current);
325 }
326 }
327
328 let listFormatRef = useRef<Intl.ListFormat | null>(null);
329

Callers

nothing calls this directly

Calls 4

isThumbEditableFunction · 0.85
replaceIndexFunction · 0.85
setDraggingsFunction · 0.85
onChangeEndFunction · 0.50

Tested by

no test coverage detected