Fix onAppear animation issue
#59
Open
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Issue Link 🔗
Goals ⚽
We had a bug reappear that we hoped was fixed in f025e9b where the Skeleton loader would fly in from the top left edge of the screen.
From my investigation this and the above mentioned issues are cause inside a
NavigationView/Stackwhen trying to animate a view before it appears on the screen. So the animation tries to animate the view in (starting from the origin).For more details see this S/O posts:
Implementation Details 🚧
This uses the
.taskview modifier instead ofonAppearwhen it's available on iOS 15+ and uses the old DispatchQueue logic / fix for previous version. This seems to solve the issue for us.Also, replacing the implicit
.animationmodifier with a explicitwithAnimationblock, see also this Reddit comment:This bug seems quite tricky to reproduce reliably tho, and depends on other setup as well. If needed I can look into providing a demo project showcasing the bug. Or alternatively can try to check out FB13795514 on openradar, when it's back up.. :,)
Testing Details 🔍
I got to a state where I could somewhat reliably reproduce the issue and tested it manually many times and as said wasn't able to reproduce the bug with this fix on iOS 18, 26.