提问人:Muhammad Usman Jamil 提问时间:10/9/2023 最后编辑:AdaMuhammad Usman Jamil 更新时间:10/12/2023 访问量:14
React 日期范围选择器问题 - 在第一次单击时打开日期范围选择器时不关注输入字段
React Date Range Picker issue - not focusing on input field while date range picker is open on first click
问:
我正在使用 react-DateRangePicker,并使用输入字段,当单击输入时,它会打开该日期范围,但在日期范围选择器打开时它不专注于输入字段。我想要的行为是这样的:当我单击输入时,它会打开该日期范围选择器,但也专注于该输入,因此我也可以手动添加日期。
<input
ref={dateRangePickerInput}
value={value}
onChange={handleCustomDate}
className='form-control fc-xs rounded'
onClick={show}
/>
<Menu
className='calender-menu'
anchorEl={position}
open={openRangePicker}
onClose={hide}
MenuListProps={{
'aria-labelledby': 'basic-button',
}}
>
<DateRangePicker
onChange={item => handleChange([item.selection], dateType)}
editableDateInputs={true}
moveRangeOnFirstSelection={false}
ranges={range}
months={2}
direction="horizontal"
todayButton="Today"
autoFocus={true}
/>
</Menu>
答: 暂无答案
评论