Skip to content

Commit

Permalink
fix: 修复第二次点击面板关闭异常问题 (#2183)
Browse files Browse the repository at this point in the history
* fix: 修复第二次点击面板关闭异常问题

* fix: type error
  • Loading branch information
honkinglin authored Apr 27, 2023
1 parent 57bd8ac commit b9ccf8f
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@
},
"devDependencies": {
"@babel/core": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.16.5",
"@babel/plugin-transform-runtime": "^7.21.4",
"@babel/plugin-transform-typescript": "^7.18.10",
"@babel/preset-env": "^7.16.5",
"@babel/preset-react": "^7.16.5",
Expand All @@ -119,9 +119,9 @@
"@types/lodash": "4.14.182",
"@types/node": "^17.0.21",
"@types/raf": "^3.4.0",
"@types/react": "^18.0.25",
"@types/react-dom": "^18.0.9",
"@types/react-is": "^17.0.3",
"@types/react": "^18.2.0",
"@types/react-dom": "^18.2.1",
"@types/react-is": "^18.2.0",
"@types/react-transition-group": "^4.4.2",
"@types/rimraf": "^3.0.2",
"@types/testing-library__jest-dom": "^5.14.2",
Expand Down
4 changes: 2 additions & 2 deletions src/date-picker/DateRangePicker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -275,12 +275,12 @@ const DateRangePicker = forwardRef<HTMLDivElement, DateRangePickerProps>((props,
}

// 首次点击不关闭、确保两端都有有效值并且无时间选择器时点击后自动关闭
if (!isFirstValueSelected) {
if (!isFirstValueSelected || nextValue.length === 1) {
let nextIndex = notValidIndex;
if (nextIndex === -1) nextIndex = activeIndex ? 0 : 1;
setActiveIndex(nextIndex);
setIsFirstValueSelected(true);
} else {
} else if (nextValue.length === 2) {
setPopupVisible(false);
}
}
Expand Down

0 comments on commit b9ccf8f

Please sign in to comment.