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

ColorPicker onChange is not updating the button color after the event fires #172

Open
Ormesome opened this issue Jul 29, 2021 · 1 comment

Comments

@Ormesome
Copy link

Describe the bug
The specified handler fires, but the button itself remains white.

To Reproduce

<ColorPicker
id="newCategoryColour"
palette={colourOptions}
onChange={(e) => handleNewCategoryColour(e)}
hideTextfield
/>

Expected behavior
The event should fire, and the button should change color to that specified.

@lifeeric
Copy link
Contributor

lifeeric commented Oct 18, 2021

Hello @Ormesome, as I understand you need to pass the value props to the component, so it will update the color, thank you!

 const [color, setColor] = useState(createColor("red"));
  const handleChange = (newValue: Color) => {
    setColor(newValue);
  };

//...

<ColorPicker
  id="newCategoryColour"
  palette={colourOptions}
  value={color}
  onChange={handleChange}
  hideTextfield
/>

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

2 participants