AppFlowy-IO / AppFlowy-IO/appflowy-editor

[Bug] Sometimes toolbar not display above keyboard - iOS

オープン
#1,104 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る
主要言語
Dart
スター
684
フォーク
329
PR マージ指標
30日以内にマージされた PR はありません

説明

### Bug Description

Sometimes keyboard is opening without toolbar.
I investigate the issue;
mobile_toolbar_v2.dart > _MobileToolbarState
```
@override
void initState() {
super.initState();

currentSelection = widget.editorState.selection;
KeyboardHeightObserver.instance.addListener(_onKeyboardHeightChanged);
}
```
Code is working without a problem if keyboard_height_observer.dart notify calls after this init.

But sometimes, if you fastly close the keyboard and tap the editor, or randomly tap the editor.
Firstly, keyboard_height_observer.dart notify is calling then mobile_toolbar_v2.dart > _MobileToolbarState initState calling. So _MobileToolbarState cachedKeyboardHeight value is always 0. And there is no space under the toolbar.

Possible fix:
keyboard_height_observer.dart
```
void addListener(KeyboardHeightCallback listener) {
_listeners.add(listener);

//Always trigger the initial value for newly added listeners.
listener(currentKeyboardHeight);
}
```
I'm not sure this fix is the best, because it notifies all newly added listeners, it may not expected behaviour.

### How to Reproduce

Open the example project
add new paragraph
click the close icon on toolbar
tap the newly added paragraph end.
You most probably see keyboard without toolbar.

### Expected Behavior

When keyboard is open, always visible toolbar.

### Operating System

iOS

### AppFlowy Editor Version(s)

5.2.0

### Screenshots

https://github.com/user-attachments/assets/9f5c4b67-665f-42cd-9236-6112645ebd3b

### Additional Context

_No response_

コントリビューションガイド

このリポジトリのコントリビューションガイドは索引されていません

評価

この issue はまだ評価されていません。

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。