UNPKG

764 BTypeScriptView Raw
1import React, { useState } from "react";
2
3import { DateRange, DayPicker } from "react-day-picker";
4
5/**
6 * Test case for issue #1567
7 *
8 * @see https://github.com/gpbl/react-day-picker/issues/1567
9 */
10export function TestCase1567() {
11 const [selected, setSelected] = useState<DateRange | undefined>({
12 from: new Date(2022, 8, 25),
13 to: new Date(2022, 9, 1)
14 });
15
16 const handleChange = (range: DateRange | undefined) => {
17 range && setSelected(range);
18 };
19 return (
20 <div className="App">
21 <DayPicker
22 mode="range"
23 onSelect={handleChange}
24 numberOfMonths={2}
25 showOutsideDays
26 selected={selected}
27 fromMonth={new Date(2020, 5)}
28 />
29 <button>I should be focusable</button>
30 </div>
31 );
32}