Avoid reapplying all RepeatingChangeEffectModifier changes in each onAppear
When using an effect as RepeatingChangeEffectModifier inside a lazy stack, it is possible that onAppear is called multiple times when the view comes back to being visible. That would cause the shine effect to repeat RepeatingChangeEffectModifier.timer.count times when becoming visible again. This PR tries to fix this by pausing/resetting the timer count when the view disappears. I hope this is the correct way to solve this 🙂
|
https://github.com/EmergeTools/Pow/assets/9310224/67531f90-04d9-476d-a283-ada50ec78ebb |
Hey @jonasrottmann, sorry for the delayed reply — I was very heads down on shipping my app and hadn't had the time to look this change over. I reached out to @robb to see if this change could have any side effects and he mentioned that this may cause problems due to ScrollView visibility, two views could get out of sync if one of them scrolled offscreen. I don't have a fix in mind to account for that, but I wanted to note that there may be another layer of consideration.