Improving Keyboard Appearance Synchronization
还没有人认领这个 Issue。
评估
调研方向
首先定位使用 delay(for: .milliseconds(200), scheduler: DispatchQueue.main) 的键盘处理代码。检查 keyboardWillShowNotification 和 keyboardDidShowNotification 的 userInfo 值,然后验证视图更新是否遵循报告的动画持续时间,并与键盘保持同步。
由索引模型根据 Issue 内容生成。
描述
Suggestion for Improvement:
Hi, I noticed that when the keyboard appears, the view shift has a noticeable delay. The current implementation uses delay(for: .milliseconds(200), scheduler: DispatchQueue.main), but a fixed 200ms delay is unreliable for the following reasons:
Keyboard animation duration is not fixed – The actual animation time varies across iOS versions, devices, and user settings (e.g., "Reduce Motion"). Using a hardcoded 200ms delay may cause desynchronization, leading to lag or visual inconsistencies.
Asynchronous execution may fluctuate – Since DispatchQueue.main might have other tasks running, the actual delay could be longer than expected due to main thread load, further impacting responsiveness.
Not in sync with keyboard events – iOS provides keyboardWillShowNotification and keyboardDidShowNotification, which include the actual animation duration and curve in userInfo[UIKeyboardAnimationDurationUserInfoKey]. Using these ensures smooth and synchronized UI updates rather than relying on an arbitrary delay.
I suggest listening to keyboardWillShowNotification and using the provided animation duration instead. This will help achieve a more consistent and fluid user experience.
Looking forward to your thoughts! Thanks for your great work on this library.
- 主要语言
- Swift
- 星标
- 6.3k
- 派生
- 1.2k
- 平均合并
- 12 小时 4 分钟
- 30 天内合并 PR
- 9
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
MessageKit/MessageKit 的其他 Issue
-
Keyboard bug 未关闭bug?
难度 3/5 1-2 天 新手友好度 45/100
MessageKit/MessageKit#1901 ·
-
question
难度 4/5 3-5 天 新手友好度 35/100
MessageKit/MessageKit#1888 · 2 条评论 ·
-
Transparent navigation bar in messageInputBar but messagesCollectionView is not shown in these areas 未关闭feature request
难度 3/5 1-2 天 新手友好度 35/100
MessageKit/MessageKit#1884 · 1 条评论 ·
-
bug?
难度 4/5 3-5 天 新手友好度 35/100
MessageKit/MessageKit#1878 ·
-
feature request
难度 3/5 1-2 天 新手友好度 38/100
MessageKit/MessageKit#1874 · 1 条评论 ·
查看 MessageKit/MessageKit 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 75/100
-
area:general bug P1 security
难度 2/5 1-3 小时 新手友好度 75/100
uttrflow/uttrflow-swift#1333 ·
-
难度 2/5 1-3 小时 新手友好度 75/100
-
难度 2/5 1-3 小时 新手友好度 75/100
maxgoedjen/secretive#840 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
manaflow-ai/cmux#13763 ·