Skip to content

Commit

Permalink
fix: 日历组件滚动到顶部时 出现空白问题 (#2409)
Browse files Browse the repository at this point in the history
  • Loading branch information
522109452 authored Jul 10, 2024
1 parent cbf6765 commit a006931
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/packages/calendaritem/calendaritem.taro.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ export const CalendarItem = React.forwardRef<
const scrollTop = (e.target as HTMLElement).scrollTop
Taro.getEnv() === 'WEB' && setScrollTop(scrollTop)
let current = Math.floor(scrollTop / avgHeight)
if (current < 0) return
if (!monthsData[current + 1]) return
const nextTop = monthsData[current + 1].scrollTop
const nextHeight = monthsData[current + 1].cssHeight
Expand Down
1 change: 1 addition & 0 deletions src/packages/calendaritem/calendaritem.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -530,6 +530,7 @@ export const CalendarItem = React.forwardRef<
}
const scrollTop = (e.target as HTMLElement).scrollTop
let current = Math.floor(scrollTop / avgHeight)
if (current < 0) return
if (!monthsData[current + 1]) return
const nextTop = monthsData[current + 1].scrollTop
const nextHeight = monthsData[current + 1].cssHeight
Expand Down

0 comments on commit a006931

Please sign in to comment.