@@ -40,12 +40,6 @@ export default function useRangeOpen(
4040 firstTimeOpen : boolean ,
4141 triggerOpen : ( open : boolean , activeIndex : 0 | 1 | false , source : SourceType ) => void ,
4242] {
43- // We record opened status here in case repeat open with picker
44- // const [openRecord, setOpenRecord] = React.useState<{
45- // 0?: boolean;
46- // 1?: boolean;
47- // }>({});
48-
4943 const [ firstTimeOpen , setFirstTimeOpen ] = React . useState ( false ) ;
5044
5145 const [ mergedOpen , setMergedOpen ] = useMergedState ( defaultOpen || false , {
@@ -62,8 +56,6 @@ export default function useRangeOpen(
6256 const [ nextActiveIndex , setNextActiveIndex ] = React . useState < 0 | 1 > ( null ) ;
6357
6458 const triggerOpen = useEvent ( ( nextOpen : boolean , index : 0 | 1 | false , source : SourceType ) => {
65- // console.error('✅', nextOpen, index, source, startSelectedValue, endSelectedValue);
66-
6759 if ( index === false ) {
6860 // Only when `nextOpen` is false and no need open to next index
6961 setMergedOpen ( nextOpen ) ;
@@ -79,32 +71,16 @@ export default function useRangeOpen(
7971 // Also set next index if next is empty
8072 ! [ startSelectedValue , endSelectedValue ] [ nextIndex ]
8173 ) {
82- // Reset open record
83- // setOpenRecord({
84- // [index]: true,
85- // });
8674 setFirstTimeOpen ( true ) ;
8775 setNextActiveIndex ( nextIndex ) ;
8876 } else {
89- // setOpenRecord((ori) => ({
90- // ...ori,
91- // [index]: true,
92- // }));
9377 setFirstTimeOpen ( false ) ;
9478
9579 if ( nextActiveIndex !== null ) {
9680 setNextActiveIndex ( null ) ;
9781 }
9882 }
9983 } else if ( source === 'confirm' || ( source === 'blur' && changeOnBlur ) ) {
100- // Close if current value is empty
101- // const selectedValue = [startSelectedValue, endSelectedValue][index];
102-
103- // if (!selectedValue) {
104- // setMergedOpen(false);
105- // return;
106- // }
107-
10884 if ( nextActiveIndex !== null ) {
10985 setFirstTimeOpen ( false ) ;
11086 setMergedActivePickerIndex ( nextActiveIndex ) ;
0 commit comments