Skip to content

Commit 108af1c

Browse files
authored
Revert "No static locale infra (#2684)" (#2702)
This reverts commit 295e12e.
1 parent 662ec55 commit 108af1c

File tree

3 files changed

+16
-56
lines changed

3 files changed

+16
-56
lines changed

src/components/colorPicker/colorPicker.api.json

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,10 @@
2626
"description": "Callback for the picker's color palette change"
2727
},
2828
{
29-
"name": "getAccessibilityLabels",
30-
"type": "() => {\n addButton: string,\n dismissButton: string,\n doneButton: string,\n input: string}",
31-
"description": "A function that returns the accessibility labels as an object of strings",
32-
"default": "() => {\n addButton: 'add custom color using hex code',\n dismissButton: 'dismiss',\n doneButton: 'done',\n input: 'custom hex color code'\n}"
29+
"name": "accessibilityLabels",
30+
"type": "{\n addButton: string,\n dismissButton: string,\n doneButton: string,\n input: string}",
31+
"description": "Accessibility labels as an object of strings",
32+
"default": "{\n addButton: 'add custom color using hex code',\n dismissButton: 'dismiss',\n doneButton: 'done',\n input: 'custom hex color code'\n}"
3333
},
3434
{"name": "testID", "type": "string", "description": "The test id for e2e tests"},
3535
{"name": "backgroundColor", "type": "string", "description": "The ColorPicker's background color"}

src/components/colorPicker/index.tsx

Lines changed: 8 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,6 @@ import ColorPalette, {ColorPaletteProps} from '../colorPalette';
88
import {SWATCH_MARGIN, SWATCH_SIZE} from '../colorSwatch';
99
import ColorPickerDialog, {ColorPickerDialogProps} from './ColorPickerDialog';
1010

11-
interface AccessibilityLabels {
12-
addButton?: string;
13-
dismissButton?: string;
14-
doneButton?: string;
15-
input?: string;
16-
}
17-
1811
interface Props extends ColorPickerDialogProps, Pick<ColorPaletteProps, 'onValueChange'> {
1912
/**
2013
* Array of colors for the picker's color palette (hex values)
@@ -36,19 +29,13 @@ interface Props extends ColorPickerDialogProps, Pick<ColorPaletteProps, 'onValue
3629
* doneButton: 'done',
3730
* input: 'custom hex color code'
3831
* }
39-
* @deprecated
4032
*/
41-
accessibilityLabels?: AccessibilityLabels;
42-
/**
43-
* A function that returns the accessibility labels as an object of strings, ex.
44-
* {
45-
* addButton: 'add custom color using hex code',
46-
* dismissButton: 'dismiss',
47-
* doneButton: 'done',
48-
* input: 'custom hex color code'
49-
* }
50-
*/
51-
getAccessibilityLabels?: () => AccessibilityLabels;
33+
accessibilityLabels?: {
34+
addButton?: string;
35+
dismissButton?: string;
36+
doneButton?: string;
37+
input?: string;
38+
};
5239
testID?: string;
5340
/**
5441
* The ColorPicker's background color
@@ -74,7 +61,7 @@ class ColorPicker extends PureComponent<Props> {
7461
static displayName = 'ColorPicker';
7562

7663
static defaultProps = {
77-
getAccessibilityLabels: () => ACCESSIBILITY_LABELS,
64+
accessibilityLabels: ACCESSIBILITY_LABELS,
7865
backgroundColor: Colors.$backgroundDefault
7966
};
8067

@@ -99,17 +86,7 @@ class ColorPicker extends PureComponent<Props> {
9986
};
10087

10188
render() {
102-
const {
103-
initialColor,
104-
colors,
105-
value,
106-
testID,
107-
accessibilityLabels: deprecatedAccessibilityLabels,
108-
getAccessibilityLabels,
109-
backgroundColor,
110-
onValueChange
111-
} = this.props;
112-
const accessibilityLabels = deprecatedAccessibilityLabels ?? getAccessibilityLabels?.();
89+
const {initialColor, colors, value, testID, accessibilityLabels, backgroundColor, onValueChange} = this.props;
11390
const {show} = this.state;
11491
return (
11592
<View row testID={testID} style={{backgroundColor}}>

src/components/slider/ColorSliderGroup.tsx

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@ import Text from '../text';
88

99
type SliderOnValueChange = (value: string) => void;
1010

11-
type Labels = {[key in GradientSliderTypes]: string};
12-
1311
export type ColorSliderGroupProps = {
1412
/**
1513
* The gradient color
@@ -31,17 +29,11 @@ export type ColorSliderGroupProps = {
3129
* Show the sliders labels (defaults are: Hue, Lightness, Saturation)
3230
*/
3331
showLabels?: boolean;
34-
/**
35-
* In case you would like to change the default labels (translations etc.), you can provide
36-
* this prop with a map to the relevant labels ({hue: ..., lightness: ..., saturation: ...}).
37-
* @deprecated
38-
*/
39-
labels?: Labels;
4032
/**
4133
* In case you would like to change the default labels (translations etc.), you can provide
4234
* this prop with a map to the relevant labels ({hue: ..., lightness: ..., saturation: ...}).
4335
*/
44-
getLabels?: () => Labels;
36+
labels?: {[key in GradientSliderTypes]: string};
4537
/**
4638
* The labels style
4739
*/
@@ -50,7 +42,7 @@ export type ColorSliderGroupProps = {
5042
* If true the component will have accessibility features enabled
5143
*/
5244
accessible?: boolean;
53-
/**
45+
/**
5446
* Whether to use the new Slider implementation using Reanimated
5547
*/
5648
migrate?: boolean;
@@ -69,7 +61,7 @@ class ColorSliderGroup extends PureComponent<ColorSliderGroupProps, ColorSliderG
6961
static displayName = 'ColorSliderGroup';
7062

7163
static defaultProps = {
72-
getLabels: () => ({hue: 'Hue', lightness: 'Lightness', saturation: 'Saturation'})
64+
labels: {hue: 'Hue', lightness: 'Lightness', saturation: 'Saturation'}
7365
};
7466

7567
state = {
@@ -91,16 +83,7 @@ class ColorSliderGroup extends PureComponent<ColorSliderGroupProps, ColorSliderG
9183
};
9284

9385
renderSlider = (type: GradientSliderTypes) => {
94-
const {
95-
sliderContainerStyle,
96-
showLabels,
97-
labelsStyle,
98-
accessible,
99-
labels: deprecatedLabels,
100-
getLabels,
101-
migrate
102-
} = this.props;
103-
const labels = deprecatedLabels ?? getLabels?.();
86+
const {sliderContainerStyle, showLabels, labelsStyle, accessible, labels, migrate} = this.props;
10487

10588
return (
10689
<>

0 commit comments

Comments
 (0)