Skip to content
This repository has been archived by the owner on Jan 31, 2024. It is now read-only.

Commit

Permalink
Fix update value in colorPicker
Browse files Browse the repository at this point in the history
  • Loading branch information
jducro committed Dec 11, 2018
1 parent 6a47acb commit 81350e7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@deskpro/react-components",
"version": "1.4.5-beta.1",
"version": "1.4.5-beta.2",
"description": "Deskpro React Components",
"main": "dist/index.js",
"homepage": "https://github.com/deskpro/react-components",
Expand Down
7 changes: 2 additions & 5 deletions src/Components/Forms/Colorpicker.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@ class Colorpicker extends React.Component {

this.state = {
displayColorPicker: false,
color: props.value,
};
}

Expand All @@ -55,12 +54,10 @@ class Colorpicker extends React.Component {
handleClose = () => {
const { name } = this.props;
this.setState({ displayColorPicker: false });

this.props.onChange(this.state.color, name);
};

handleChange = (color) => {
this.setState({ color: color[this.props.format] });
this.props.onChange(this.state.color, color[this.props.format]);
};

render() {
Expand Down Expand Up @@ -101,7 +98,7 @@ class Colorpicker extends React.Component {
{ this.state.displayColorPicker ? (
<div className="dp-colorpicker--popover">
<div className="dp-colorpicker--popover--cover" onClick={this.handleClose} />
<SketchPicker color={this.state.color} onChange={this.handleChange} />
<SketchPicker color={color} onChange={this.handleChange} />
</div>
) : null }
</div>
Expand Down

0 comments on commit 81350e7

Please sign in to comment.