`@effect/ui-native` (Effect-TS/ui): `internal/focus.ts` `trackKeyboard` ignores `keyboardWillChangeFrame` / `keyboardDidChangeFrame` dismissal

オープン
#11,095 コメント 0 件 リアクション 0 件 担当者 1 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

@effect-bot がすでに取り組んでいます。

2026年11月29日 から。

評価

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

説明

partially generated with help of my ai friend - neon 4.4

Hi effect team,
I was trying out this package and wanted to report some bugs encountered while porting a library to effect native

What version of Effect is running?
  • effect: 4.1.7
  • @effect/ui & @effect/ui-native: Effect-TS/ui main at 77391ee50ae3d3175d670facbf675e9a819ba6a6
  • react-native: 0.88.1
What steps can reproduce the bug?
  1. Clone the minimal reproduction repository:
    git clone https://github.com/cliffordfajardo/effectui-native-error-reproductions.git
    cd effectui-native-error-reproductions
    pnpm install
    pnpm vitest run 09-focus-keyboard-misses-frame-change-dismiss
    
  2. Mount a scroll container (default keyboardShouldPersistTaps: "never") containing an input and a pressable button.
  3. Focus the input (topFocus), emit keyboardDidShow (height: 336), then dismiss the keyboard interactively on iOS via keyboardDidChangeFrame with an off-screen / zero-height endCoordinates (screenY: 852, height: 0), and tap the button inside the scroll container (see 09-focus-keyboard-misses-frame-change-dismiss/repro.test.ts).
What is the expected behavior?

When iOS dismisses or moves the keyboard off-screen via keyboardWillChangeFrame / keyboardDidChangeFrame, focus.keyboard should clear to undefined (matching kit/Keyboard.ts), so tapping a button inside the ScrollView fires press normally.

What do you see instead?

focus.keyboard remains stuck at 336, so internal/touch.ts:223-244 (persist()) still believes the soft keyboard is covering the app and swallows the button tap (0 presses fired).

In packages/ui-native/src/internal/focus.ts:36-48:

for (
  const event of [
    "keyboardWillShow",
    "keyboardDidShow",
    "keyboardWillHide",
    "keyboardDidHide"
  ]
) {
  const shown = event.endsWith("Show")
  observe(device, "KeyboardObserver", event, (e) => {
    focus.keyboard = shown ? e?.endCoordinates?.height ?? 0 : undefined
  })
}
Additional information

packages/ui-native/src/kit/Keyboard.ts:88-116 already documents and handles this exact iOS behavior:

// iOS reports a keyboard dismissed interactively, or moved off the screen,
// as a frame change rather than a hide.
const offScreen = (d: Native.Device, frame: any) => {
  const screen = dimensions(d).get().screen.height
  return frame == null || frame.height <= 0 ||
    (screen > 0 && frame.screenY >= screen)
}

Subscribing trackKeyboard in internal/focus.ts to keyboardWillChangeFrame and keyboardDidChangeFrame with the same offScreen check will keep focus.keyboard consistent with kit/Keyboard.

主要言語
TypeScript
スター
16.7k
フォーク
808
平均マージ
21時間 22分
マージ済み PR(30日)
486

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

Effect-TS/effect のほかの issue

Effect-TS/effect の issue をすべて見る

似ている issue

TypeScript の issue をもっと見る

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

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