Skip to content
This repository has been archived by the owner on Oct 6, 2023. It is now read-only.

关于重组作用域有几个问题 #129

Answered by RugerMcCarthy
biubiuqiu0 asked this question in Q&A
Discussion options

You must be logged in to vote

这个问题是其实是由于Button的点击波纹效果导致的。
在我们创建Button时,Compose会为我们创建一个交互事件源

这个事件源其中包裹了一个flow实例

再回到之前所调用的evelation方法中,evelation仅有这一个默认实现,他在其中声明了一个协程用于监听事件源,当事件源发送数据时,此时在evelation中创建的interactions这个mutableStateList会发生更新,这也导致了整个evelation方法会发生recompose,并且由于外部依赖于evelation这个composable的返回值,所以外部也会参与到recompose中,也就发生了你所看到的整个Button的recompose

这么说你理解了嘛?

Replies: 5 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by whitescent
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
question Further information is requested 值得研究的问题
4 participants
Converted from issue

This discussion was converted from issue #101 on June 11, 2021 00:07.