mantinedev / mantine

A fully featured React components library
https://mantine.dev
MIT License
26.98k stars 1.9k forks source link

onChange is already specified in PickerBaseProps #6740

Closed yuho-sumitomo closed 3 months ago

yuho-sumitomo commented 3 months ago

Link to the page where something is not right

https://mantine.dev/dates/date-picker-input/

What is wrong?

import { useState } from 'react';
import { DatePickerInput } from '@mantine/dates';

function Demo() {
  const [value, setValue] = useState<Date | null>(null);
  return (
    <DatePickerInput
      label="Pick date"
      placeholder="Pick date"
      value={value}
      onChange={setValue}
    />
  );
}

This usage causes the following error and does not work properly 'onChange' is specified more than once, so this usage will be overwritten.ts(2783)

I think it is because it is used in PickerBaseProps

(property) PickerBaseProps<"default">.onChange?: ((value: DateValue) => void) | undefined
Called when value changes
rtivital commented 3 months ago

I cannot reproduce the issue on codesandbox – https://codesandbox.io/p/sandbox/mantine-react-template-forked-lwk62y?file=%2Fsrc%2FApp.tsx%3A4%2C1&workspaceId=dd881b63-29f6-464c-bcdf-b5f78ad65b26

yuho-sumitomo commented 3 months ago

Sorry, it was a problem with my environment. Thanks for checking.