Skip to content

Commit

Permalink
Merge pull request #2762 from XiaoMi/hotfix/date-pciker/2757
Browse files Browse the repository at this point in the history
fix(date-picker): 修复受控模式下设置 showTime 后交互和界面问题 (#2757)
  • Loading branch information
solarjoker authored Mar 8, 2024
2 parents b03249f + 240d02e commit 27d080e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 10 deletions.
5 changes: 5 additions & 0 deletions .changeset/itchy-pigs-promise.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/hiui": patch
---

fix(date-picker): 修复受控模式下设置 showTime 后 Input 框没有实时显示选择的值问题
5 changes: 5 additions & 0 deletions .changeset/poor-camels-protect.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@hi-ui/date-picker": patch
---

fix: 修复受控模式下设置 showTime 后 Input 框没有实时显示选择的值问题
22 changes: 12 additions & 10 deletions packages/ui/date-picker/src/components/root.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,17 +56,19 @@ const Root = ({

useEffect(() => {
setInputData(
value
? parseValue(
value,
type,
weekOffset,
typeof format === 'string' ? format : undefined,
strideSelectMode
)
: outDate
parseValue(
value,
type,
weekOffset,
typeof format === 'string' ? format : undefined,
strideSelectMode
)
)
}, [value, format, type, outDate, weekOffset, strideSelectMode])
}, [value, format, type, weekOffset, strideSelectMode])

useEffect(() => {
setInputData(outDate)
}, [outDate])

const onPickerClickEvent = (index: number) => {
if (disabled) return
Expand Down

0 comments on commit 27d080e

Please sign in to comment.