-
Notifications
You must be signed in to change notification settings - Fork 6k
[iOS] Fix random jitter in keyboard animation and correct spring animation target time. #41201
Conversation
|
|
||
| static constexpr int kMicrosecondsPerSecond = 1000 * 1000; | ||
| static constexpr CGFloat kScrollViewContentSize = 2.0; | ||
| static constexpr fml::TimeDelta kKeyboardAnimationUpdateViewportMetricsDelay = |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This does make the animation better, but an arbitrary delay could also cause janks.
Maybe instead of relying on a arbitrary delay, we could try a solution where the keyboard animation and rasterizer is synchronized, similar to macOS PlatformView.
One thing to try is to get a callback from the Shell when frame is finished rasterizing and synchronously run the keyboard animation with a mutex.
https://github.com/flutter/engine/blob/main/shell/common/shell.cc#L1447
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since an arbitrary delay maybe cause some another issue. What I m going to do is to make SetViewportMetrics call after vsync process callback. Maybe using raster callback is a little bit late. I will raise a new PR for changing that and have a try on that. This marks as draft. ^_^
|
I will try a new way to implement this recently. Marks as draft. ^_^ |
Fix
Preview
Maybe video will be compressed by github. Here is original video zip can show the effect better:
videos.zip
Locally test for reviewers
flutter framework ref:
masterDemo code
Before
The keyboard inset is still little behind the system's keyboard, and we can see the random jitter (especially on 60FPS devices, tested on 60HZ devices like iPhone12 can obviously watch the issue)
Attention on third time when opening the keyboard in below video we can see the random jitter.
RPReplay_Final1681459397.mov
After
The animation is smoother and the bottom inset can follow the system keyboard better.
4.14.mp4
Pre-launch Checklist
///).