Skip to content

Commit 08c9fc8

Browse files
authored
Incubator.Slider - fix onValueChange throttle (#2598)
ColorPicker - add 'migrate' prop to use new SliderImplementation
1 parent 4402fe1 commit 08c9fc8

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/components/colorPicker/ColorPickerDialog.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@ interface Props extends DialogProps {
5151
doneButton?: string,
5252
input?: string
5353
};
54+
/**
55+
* Whether to use the new Slider implementation using Reanimated
56+
*/
57+
migrate?: boolean;
5458
}
5559
export type ColorPickerDialogProps = Props;
5660

@@ -247,6 +251,7 @@ class ColorPickerDialog extends PureComponent<Props, State> {
247251

248252
renderSliders() {
249253
const {keyboardHeight, color} = this.state;
254+
const {migrate} = this.props;
250255
const colorValue = color.a === 0 ? Colors.$backgroundInverted : Colors.getHexString(color);
251256

252257
return (
@@ -258,6 +263,7 @@ class ColorPickerDialog extends PureComponent<Props, State> {
258263
labelsStyle={styles.label}
259264
onValueChange={this.onSliderValueChange}
260265
accessible={false}
266+
migrate={migrate}
261267
/>
262268
);
263269
}

src/incubator/Slider/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ const Slider = React.memo((props: Props) => {
139139

140140
const onValueChangeThrottled = useCallback(_.throttle(value => {
141141
onValueChange?.(value);
142-
}, 100), [onValueChange]);
142+
}, 200), [onValueChange]);
143143

144144
const onRangeChangeThrottled = useCallback(_.throttle((min, max) => {
145145
onRangeChange?.({min, max});

0 commit comments

Comments
 (0)