Skip to content

Commit b2c43e7

Browse files
authored
Merge branch 'next' into feat/infiniteloading-defaultScroll
2 parents 9491fb2 + c5ba309 commit b2c43e7

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

src/packages/calendaritem/calendaritem.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,7 @@ export const CalendarItem = React.forwardRef<
170170
? ([...(defaultValue as string[])] as string[])
171171
: (defaultValue as string[])
172172
}
173-
return undefined
173+
return type === 'single' ? '' : []
174174
}
175175

176176
const [currentDate, setCurrentDate] = usePropsValue<CalendarValue>({
@@ -451,7 +451,7 @@ export const CalendarItem = React.forwardRef<
451451
}
452452

453453
useEffect(() => {
454-
setCurrentDate(resetDefaultValue() || [])
454+
setCurrentDate(resetDefaultValue())
455455
}, [defaultValue])
456456

457457
useEffect(() => {

src/packages/tabs/tabs.taro.tsx

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -160,15 +160,9 @@ export const Tabs: FunctionComponent<Partial<TabsProps>> & {
160160
to: number,
161161
direction: 'horizontal' | 'vertical'
162162
) => {
163-
let count = 0
164-
const frames = 1
165-
166-
function animate() {
167-
if (direction === 'horizontal') setScrollLeft(to)
168-
else setScrollTop(to)
169-
if (++count < frames) raf(animate)
170-
}
171-
animate()
163+
// 使用ScrollView组件此处不需要手动raf scrollLeft
164+
if (direction === 'horizontal') setScrollLeft(to)
165+
else setScrollTop(to)
172166
}
173167
const scrollIntoView = (index: number) => {
174168
raf(() => {
@@ -190,14 +184,12 @@ export const Tabs: FunctionComponent<Partial<TabsProps>> & {
190184
.slice(0, index)
191185
.reduce((prev: number, curr: RectItem) => prev + curr.width, 0)
192186
to = left - (navRect.width - titleRect.width) / 2
193-
// to < 0 说明不需要进行滚动,页面元素已全部显示出来
194-
if (to < 0) return
195-
to = rtl ? -to : to
196187
}
188+
scrollDirection(to, direction)
189+
197190
nextTick(() => {
198191
scrollWithAnimation.current = true
199192
})
200-
scrollDirection(to, direction)
201193
})
202194
})
203195
}

0 commit comments

Comments
 (0)