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

Function Example

packages/react-aria/test/slider/useSliderThumb.test.js:347–370  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

345 let stateRef = React.createRef();
346
347 function Example(props) {
348 let trackRef = useRef(null);
349 let inputRef = useRef(null);
350 let state = useSliderState({...props, numberFormatter});
351 stateRef.current = state;
352 let {trackProps} = useSlider(props, state, trackRef);
353 let {inputProps, thumbProps} = useSliderThumb(
354 {
355 ...props,
356 'aria-label': 'Min',
357 index: 0,
358 trackRef,
359 inputRef: inputRef
360 },
361 state
362 );
363 return (
364 <div data-testid="track" ref={trackRef} {...trackProps}>
365 <div data-testid="thumb" {...thumbProps}>
366 <input ref={inputRef} {...inputProps} />
367 </div>
368 </div>
369 );
370 }
371
372 describe('using PointerEvents', () => {
373 installPointerEvent();

Callers

nothing calls this directly

Calls 3

useSliderStateFunction · 0.90
useSliderFunction · 0.90
useSliderThumbFunction · 0.90

Tested by

no test coverage detected