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

Function updateValue

packages/react-stately/src/slider/useSliderState.ts:296–307  ·  view source on GitHub ↗
(index: number, value: number)

Source from the content-addressed store, hash-verified

294 }
295
296 function updateValue(index: number, value: number) {
297 if (isDisabled || !isThumbEditable(index)) {
298 return;
299 }
300 const thisMin = getThumbMinValue(index);
301 const thisMax = getThumbMaxValue(index);
302
303 // Round value to multiple of step, clamp value between min and max
304 value = snapValueToStep(value, thisMin, thisMax, step);
305 let newValues = replaceIndex(valuesRef.current, index, value);
306 setValues(newValues);
307 }
308
309 function updateDragging(index: number, dragging: boolean) {
310 if (isDisabled || !isThumbEditable(index)) {

Callers 3

setThumbPercentFunction · 0.85
incrementThumbFunction · 0.85
decrementThumbFunction · 0.85

Calls 6

snapValueToStepFunction · 0.90
isThumbEditableFunction · 0.85
getThumbMinValueFunction · 0.85
getThumbMaxValueFunction · 0.85
replaceIndexFunction · 0.85
setValuesFunction · 0.85

Tested by

no test coverage detected