Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EditRecurrenceMenu.commit doesn't accept any arguments #3269

Closed
2 of 4 tasks
atrudeau-vitall opened this issue Mar 8, 2021 · 2 comments · Fixed by #3500
Closed
2 of 4 tasks

EditRecurrenceMenu.commit doesn't accept any arguments #3269

atrudeau-vitall opened this issue Mar 8, 2021 · 2 comments · Fixed by #3500
Assignees
Labels
bug Scheduler The DevExtreme Reactive Scheduler component Typescript declaration

Comments

@atrudeau-vitall
Copy link

  • I have searched this repository's issues and believe that this is not a duplicate.

I'm using ...

  • React Grid
  • React Chart
  • React Scheduler

Current Behaviour

I'm creating a custom EditReccurrenceMenu layout in TypeScript, and when I try to use EditRecurrenceMenu.LayoutProps's commit property, I get expected 0 arguments, but got 1.

Expected Behaviour

I expect to be able to pass arguments into the commit property.

Steps to Reproduce

  1. Create a custom layout component for the EditReccurrenceMenu plugin in TypeScript.
  2. Try to pass an argument into the commit property, i.e. currentValue as per the source code.

Screenshots

Screen Shot 2021-03-08 at 3 45 40 PM

Screen Shot 2021-03-08 at 3 46 03 PM

Environment

  • devextreme-reactive: 2.7.5
  • react: ^17.0.1
  • browser: Chrome
  • bootstrap: none
  • react-bootstrap: none
  • material-ui: 4.11
@atrudeau-vitall
Copy link
Author

Workaround

I created my own custom LayoutProps interface to override the default commit property. Here it is my custom component if anyone else encounters this issue:

interface LayoutProps {
  isDeleting: boolean;
  buttonComponent: React.ComponentType<EditRecurrenceMenu.ButtonProps>;
  handleClose: () => void;
  // Override of EditRecurrenceMenu.LayoutProps to allow passing arguments
  commit: (value?: any) => void;
  availableOperations: any[];
  getMessage: (messageKey: string) => string;
}

export const Layout: React.FC<EditRecurrenceMenu.LayoutProps> = ({
  ...props
}) => {
    const newProps = (props as unknown) as LayoutProps;
    const { availableOperations, isDeleting, handleClose, commit } = newProps;
  
    const [currentValue, setCurrentValue] = useState(
      availableOperations[0].value
    );
    const handleChange = useCallback((value: string | number | boolean) => {
      setCurrentValue(value);
    }, []);
  
    const onCommitButtonClick = () => {
      commit(currentValue);
    };
  return ...
}

@AryamnovEugeniy AryamnovEugeniy added question Scheduler The DevExtreme Reactive Scheduler component bug and removed question labels Mar 10, 2021
@AryamnovEugeniy
Copy link
Contributor

Thank you for reporting this issue. We will fix this as soon as possible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Scheduler The DevExtreme Reactive Scheduler component Typescript declaration
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants