-
Notifications
You must be signed in to change notification settings - Fork 100
Description
The documentation mentions:
The track can be a single narrow div as in the Super simple example; however, it might be better to use at least two nested divs where the outer div is much thicker and has a transparent background and the inner div is narrow, has visible background and is centered. props should be then spread over the outer bigger div.
However, in fact if you do this there will be an issue because the trackRef will be set to the outer div, which results in no thumbs being found (it only checks direct children).
The Basic example also does it differently: https://github.com/tajo/react-range/blob/main/examples/Basic.tsx#L37
What I did for now is spread props over outer div, but set ref there to null explicitly. Then set ref={props.ref} for the inner div.
I think either the documentation should be updated to specify this, or perhaps the lib can look for thumbs in descendants instead of only direct children. Not sure if that will have side effects.
Thanks for this nice component!