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

Function RangeExample

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

Source from the content-addressed store, hash-verified

163 let stateRef = React.createRef();
164
165 function RangeExample(props) {
166 let trackRef = useRef(null);
167 let input0Ref = useRef(null);
168 let input1Ref = useRef(null);
169 let state = useSliderState({...props, numberFormatter});
170 stateRef.current = state;
171 let {trackProps, thumbProps: commonThumbProps} = useSlider(props, state, trackRef);
172 let {inputProps: input0Props, thumbProps: thumb0Props} = useSliderThumb(
173 {
174 ...commonThumbProps,
175 'aria-label': 'Min',
176 index: 0,
177 trackRef,
178 inputRef: input0Ref
179 },
180 state
181 );
182 let {inputProps: input1Props, thumbProps: thumb1Props} = useSliderThumb(
183 {
184 ...commonThumbProps,
185 'aria-label': 'Max',
186 index: 1,
187 trackRef,
188 inputRef: input1Ref
189 },
190 state
191 );
192 return (
193 <div>
194 <div data-testid="track" ref={trackRef} {...trackProps} />
195 <div data-testid="thumb0" {...thumb0Props}>
196 <input ref={input0Ref} {...input0Props} />
197 </div>
198 <div data-testid="thumb1" {...thumb1Props}>
199 <input ref={input1Ref} {...input1Props} />
200 </div>
201 </div>
202 );
203 }
204
205 describe('using PointerEvents', () => {
206 installPointerEvent();

Callers

nothing calls this directly

Calls 3

useSliderStateFunction · 0.90
useSliderFunction · 0.90
useSliderThumbFunction · 0.90

Tested by

no test coverage detected