🤖 Merge PR #45178 react-calendar: value prop can be null too by @giacomocerquone

* fix: value can be null too

* fix: update react-calendar version in typing header

* fix: add tests

Co-authored-by: giacomocerquone <cerquone96@hotmail.it>
This commit is contained in:
Giacomo Cerquone 2020-06-10 18:30:29 +02:00 committed by GitHub
parent dff60ccd7d
commit ef791359b8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 4 deletions

View File

@ -1,4 +1,4 @@
// Type definitions for react-calendar 3.0
// Type definitions for react-calendar 3.1
// Project: https://github.com/wojtekmaj/react-calendar
// Definitions by: Stéphane Saquet <https://github.com/Guymestef>, Katie Soldau <https://github.com/ksoldau>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@ -62,7 +62,7 @@ export interface CalendarProps {
tileClassName?: string | string[] | ((props: CalendarTileProperties) => string | string[] | null);
tileContent?: JSX.Element | ((props: CalendarTileProperties) => JSX.Element | null);
tileDisabled?: (props: CalendarTileProperties & { activeStartDate: Date }) => boolean;
value?: Date | Date[];
value?: Date | Date[] | null;
view?: Detail;
}

View File

@ -2,12 +2,12 @@ import * as React from 'react';
import Calendar from 'react-calendar';
interface State {
value: Date | Date[];
value: Date | Date[] | null;
}
export default class Sample extends React.Component<{}, State> {
state = {
value: new Date(),
value: null,
};
onChange = (value: Date | Date[]) => {