Skip to content

Commit 57777a4

Browse files
committed
fix(Slider): issue in communicating between Slider and Field component.
1 parent 3fc18a5 commit 57777a4

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

packages/core/src/components/Slider.tsx

+4-1
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ interface SliderToFieldProps extends FieldProps, BPSliderProps {}
2020
*/
2121
function fieldToSlider({
2222
field: { onBlur: onFieldBlur, ...field },
23-
form: { touched, errors },
23+
form: { setFieldValue, touched, errors },
2424
...props
2525
}: SliderToFieldProps): SliderProps {
2626
const fieldError = getIn(errors, field.name);
@@ -29,6 +29,9 @@ function fieldToSlider({
2929
return {
3030
intent: showError ? Intent.DANGER : Intent.NONE,
3131
...field,
32+
onChange: (value: number) => {
33+
setFieldValue(field.name, value);
34+
},
3235
...props,
3336
};
3437
}

stories/Page.tsx

+3
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@ import React from 'react';
22
import { Formik, Form, FormikHelpers } from 'formik';
33
import * as Yup from 'yup';
44

5+
import "normalize.css";
6+
import "@blueprintjs/core/lib/css/blueprint.css";
7+
58
import { FormGroup, InputGroup } from '../packages/core/src';
69
import { FormValues } from './FormValues';
710

stories/SliderPage.tsx

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export const SliderPage = () => {
2121
<article>
2222
<Formik
2323
initialValues={{
24-
longText: 0.3,
24+
longText: 3,
2525
}}
2626
validationSchema={FormValidation}
2727
onSubmit={(

0 commit comments

Comments
 (0)