Skip to content

[开发中]Swiper 支持bindtransition 和 bindanimationfinish#2391

Open
xiao19880917lu wants to merge 1 commit intomasterfrom
feat-swiper-eventhandle
Open

[开发中]Swiper 支持bindtransition 和 bindanimationfinish#2391
xiao19880917lu wants to merge 1 commit intomasterfrom
feat-swiper-eventhandle

Conversation

@xiao19880917lu
Copy link
Collaborator

No description provided.

@xiao19880917lu xiao19880917lu changed the title Swiper 支持bindtransition 和 bindanimationfinish [开发中]Swiper 支持bindtransition 和 bindanimationfinish Jan 9, 2026
}, () => {
currentIndex.value = nextIndex
runOnJS(runOnJSCallback)('loop')
runOnJS(runOnJSCallback)('handleAnimationfinish', nextIndex)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

为啥这里没有bindtransition的前置判断

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以及建议将这两个runOnJS合为一个,在js函数里再去分发,而不是调用两次runOnJS

}, () => {
currentIndex.value = nextIndex
runOnJS(runOnJSCallback)('loop')
runOnJS(runOnJSCallback)('handleAnimationfinish', nextIndex)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

以及建议将这两个runOnJS合为一个,在js函数里再去分发,而不是调用两次runOnJS

timerId.current && clearTimeout(timerId.current)
}
// resumeLoop在worklet中调用
function resumeLoop () {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用'worklet' flag声明清楚哪些函数是worklet哪些不是,不要都依赖隐身判定

currentIndex.value = selectedIndex
offset.value = resetOffset
runOnJS(runOnJSCallback)('resumeLoop')
bindanimationfinish && runOnJS(runOnJSCallback)('handleAnimationfinish', selectedIndex)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上,合并为一个runOnJS

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants