Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle id being sorted #123

Open
tobyclh opened this issue Aug 11, 2020 · 0 comments
Open

Handle id being sorted #123

tobyclh opened this issue Aug 11, 2020 · 0 comments

Comments

@tobyclh
Copy link

tobyclh commented Aug 11, 2020

Problem or feature description:

Hi, I am trying to create a slider with multiple handles each with their own colours.
I use the handle.id to assign the colour of the handles. However, I realize the handle id is not actually associated with the handle, but the value. This creates a "jump" when the user finish dragging the handle.

Steps to reproduce (for problems):

        <Slider
            rootStyle={{position:'relative', width: '80%', marginTop: '25px', marginLeft: '25px', marginRight: '25px'}}
            step={0.01}
            domain={[0, 10]} // [min, max]
            values={values} // slider values
            reversed={false}
            onChange={this.onChange}
        >
        <Rail>
          {({ getRailProps }) => <SliderRail getRailProps={getRailProps} />}
        </Rail>
        <Handles>
            {({ handles, activeHandleID, getHandleProps }) => (
            <div className="slider-handles">
                {handles.map((handle, id) => (
                <Handle 
                    className={handle.id}
                    key={handle.id}
                    handle={handle}
                    domain={[0, 10]}
                    color={colors[parseInt(handle.id.replace('$$-',''))]}
                    getHandleProps={getHandleProps}
                />
                ))
                }
            </div>
            )}
        </Handles>
        </Slider>

YouTube video showing the weird "jump" .

Versions (for problems):

React-Compound-Slider:

React:

Browser:

Operating System:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant