-
Notifications
You must be signed in to change notification settings - Fork 94
Change item(s) color onRest? #58
Copy link
Copy link
Open
Description
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!
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels