Atlaskit select onchange not working

Hi,

we are currently trying to add Atlaskit to our Serverapp lineup. We have the problem, that the onChange method for the select field is not firing at all, whereas other onChange (radio button) fires.

// Not firing
<Field name="select-field-test"
    label="Select Field Test"
>
    {({ fieldProps }: any) => (
        <React.Fragment>
            <Select className="single-select"
                classNamePrefix="react-select"
                placeholder="Please select a value"
                onChange={() => console.log("foo")}

                options={[
                    { label: "A", value: "a" },
                    { label: "B", value: "b" },
                    { label: "C", value: "c" },
                ]}
                {...fieldProps}
            />
        </React.Fragment>
    )}
</Field>

// works
<Field name="radio">
    {({ fieldProps }: any) => (
        <React.Fragment>
            <RadioGroup
                options={radioItems}
                {...fieldProps}
                onChange={(val: Object, action: Object) => { console.log(val) }}
            />
        </React.Fragment>
    )}
</Field>

We are using the following packages:

    "styled-components": "^3.2.6"
    "@atlaskit/form": "^8.1.0",
    "@atlaskit/select": "^13.0.4",

Can anyone help me with this?

Best regards,
Alex

Hey @alexander.auer1, I verified it. It’s firing onChange
Add sandbox link here

Hi, I can confirm that it is also not working for me.
I tried both "@atlaskit/select": "13.0.4" and "@atlaskit/select": "^13.1.1".

I’m not using css-reset, will it be the problem?

Could you please provide sandbox link :slight_smile:

Hi @ManishYadav, the problem is solved somehow, and the onChange event fired.
Thanks!

1 Like

how do we specify an onChange function if fieldProps.onChange already exists? Can someone explain how the code works?

I know fieldProps.onChange is responsible for updating the field state when inside a form. So what happens when we add our own onChange function? How are both fieldProps.onChange and our own custom onChange both still used?

2 Likes

Hi Alex,

I met the same problem with you. The onChange function of Select Component does not work, Can you tell me how did you solve the proble?

Thanks.
Jason

1 Like

Hi!

Have the same problem.

My problem is solved, you can see the answer here.

Select Component onChange() probelm