Skip to content

ColorPicker style prop deprecation #2444

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

Merged
merged 8 commits into from
Feb 9, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/components/colorPicker/colorPicker.api.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
"description": "Accessibility labels as an object of strings",
"default": "{\n addButton: 'add custom color using hex code',\n dismissButton: 'dismiss',\n doneButton: 'done',\n input: 'custom hex color code'\n}"
},
{"name": "style", "type": "ViewStyle", "description": "Component's style"},
{"name": "testID", "type": "string", "description": "The test id for e2e tests"}
{"name": "testID", "type": "string", "description": "The test id for e2e tests"},
{"name": "backgroundColor", "type": "string", "description": "Give the ColorPicker a background color"}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please change "Give the ColorPicker a background color" to "The ColorPicker's/Component's background color"

],
"snippet": [
"<ColorPicker",
Expand Down
9 changes: 9 additions & 0 deletions src/components/colorPicker/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import Button from '../button';
import ColorPalette from '../colorPalette';
import {SWATCH_MARGIN, SWATCH_SIZE} from '../colorSwatch';
import ColorPickerDialog, {ColorPickerDialogProps} from './ColorPickerDialog';
import {LogService} from '../../services';

interface Props extends ColorPickerDialogProps {
/**
Expand Down Expand Up @@ -70,6 +71,14 @@ class ColorPicker extends PureComponent<Props> {
backgroundColor: Colors.$backgroundDefault
};

constructor(props: Props) {
super(props);

if (props.style) {
LogService.warn(`UILib ColorPicker style prop is deprecated, please pass instead the 'backgroundColor' prop.`);
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
LogService.warn(`UILib ColorPicker style prop is deprecated, please pass instead the 'backgroundColor' prop.`);
LogService.warn(`UILib ColorPicker's 'style' prop is deprecated. You can use the 'backgroundColor' prop instead`);

}
}

state = {
show: false
};
Expand Down