Skip to content

Change item(s) color onRest? #58

Description

@juanpg

Hello,

First, thanks for putting this together. It's a great implementation!

I'm using this to create a prize spin wheel, and I would like to change all the items color to a light gray, except for the selected item, which should stay the original color. I'm doing it like this:

const newProps = {
  ...props,
  items: props.items.map((item, i) => ({
    ...item,
    backgroundColor: i === priceIndex ? item.backgroundColor : '#b1b1b1',
    labelColor: i === priceIndex ? item.labelColor : '#6b6b6b',
  })),
};
wheel.init(newProps);

wheel.spinToItem(priceIndex, 0, true);

If I don't include the last spinToItem then the wheel is reset, as expected I guess, but calling it causes a slight jump in the UI that doesn't look great. Is there a way that I can 'refresh' the colors of the items without changing the positioning of the wheel?

Thank you!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions