Skip to content

fix(frontend): Fix excessive space reserved for the keyboard on the Android login page - #346

Merged
gac0812 merged 1 commit into
1024XEngineer:mainfrom
gac0812:codex/fix-android-login-keyboard
Aug 21, 2026
Merged

fix(frontend): Fix excessive space reserved for the keyboard on the Android login page#346
gac0812 merged 1 commit into
1024XEngineer:mainfrom
gac0812:codex/fix-android-login-keyboard

Conversation

@gac0812

@gac0812 gac0812 commented Aug 21, 2026

Copy link
Copy Markdown
Contributor

改动内容

  • Android 登录页使用 KeyboardAvoidingView 管理输入法弹出后的可用高度。
  • Android ScrollView 使用 keyboardDismissMode="none",避免显示焦点输入框时的系统滚动关闭输入法。
  • 更新登录页测试,覆盖输入框焦点切换、输入法适配布局和 Android 键盘关闭策略。

原始问题

Android 登录页打开输入法后,输入框无法稳定保持输入状态,输入法可能随布局调整或滚动被关闭,导致用户无法继续输入。输入法展开时页面还可能预留超出实际需要的空间。

修复方式

由原生 KeyboardAvoidingView 负责输入法弹出后的布局避让,并关闭 Android ScrollView 的拖拽关闭输入法行为,让输入框的焦点和键盘状态在输入过程中保持稳定。这样既能保留输入框可见区域,也不会额外增加一段键盘占位。

用户影响

用户在 Android 登录页打开输入法后,可以继续在用户名或密码输入框中输入,可以正常从用户名切换到密码,输入法不会被意外关闭。

验证结果

  • npm run test:jest -- --runTestsByPath tests/unit/screens/LoginScreen.test.tsx:11 项测试通过
  • npx eslint src/screens/LoginScreen.tsx tests/unit/screens/LoginScreen.test.tsx:通过
  • npx prettier --check src/screens/LoginScreen.tsx tests/unit/screens/LoginScreen.test.tsx:通过
  • npm run typecheck:通过
  • Android 16 模拟器验证:用户名可以输入,可以切换到密码输入框,输入法保持打开

Closes #349

@gac0812 gac0812 changed the title [codex] fix Android login keyboard focus fix(frontend): prevent Android login keyboard dismissal Aug 21, 2026
@gac0812
gac0812 marked this pull request as ready for review August 21, 2026 07:20
@gac0812 gac0812 changed the title fix(frontend): prevent Android login keyboard dismissal fix(frontend): 修复安卓登录页输入法自动关闭问题 Aug 21, 2026
@gac0812
gac0812 marked this pull request as draft August 21, 2026 07:21
@codecov

codecov Bot commented Aug 21, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@gac0812
gac0812 marked this pull request as ready for review August 21, 2026 07:23

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

这次改动正确地把原生 Android 输入法避让与父节点位移解耦;我也检查了登录页的焦点切换、认证锁定和现有 IME 工具测试。下面有一个跨平台回归需要处理。

已验证:tests/unit/screens/LoginScreen.test.tsxtests/unit/shared/ui/useImeOverlap.test.ts 共 17 项通过;目标文件 ESLint 与 npm run typecheck 通过。react-native-webKeyboardAvoidingView 实现不会响应键盘事件,因此移动 Web 的输入法避让仍需保留单独的 visual-viewport 路径。

Comment thread frontend/src/screens/LoginScreen.tsx
@gac0812
gac0812 marked this pull request as draft August 21, 2026 07:26
@gac0812
gac0812 marked this pull request as ready for review August 21, 2026 07:26

@fennoai fennoai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

审查了登录页的 Android 输入法避让、焦点切换、ScrollView 键盘策略以及认证状态路径。Android 目标行为的改动方向正确,但当前实现回归了已有的移动 Web 输入法适配:useImeOverlap 原本通过 visualViewport 为 Web 提供布局避让,而新的 KeyboardAvoidingView 在 Web 上传入 behavior={undefined},不会替代这条路径。请保留 Web 的 viewport 避让逻辑,并仅在原生平台使用新的键盘布局方案。

验证:git diff --check 通过;目标 Jest/ESLint/Prettier/TypeScript 命令无法在当前 checkout 执行,因为依赖安装不完整,node_modules/.bin/jest 不存在。

Comment thread frontend/src/screens/LoginScreen.tsx
@gac0812 gac0812 changed the title fix(frontend): 修复安卓登录页输入法自动关闭问题 fix(frontend): 修复安卓登录页为输入法预留空间过大 Aug 21, 2026
@gac0812 gac0812 changed the title fix(frontend): 修复安卓登录页为输入法预留空间过大 fix(frontend): Fix excessive space reserved for the keyboard on the Android login page Aug 21, 2026
@gac0812
gac0812 merged commit 889ac5b into 1024XEngineer:main Aug 21, 2026
12 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(frontend): Android 登录页为输入法预留空间过多

2 participants