You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

Expo KeyboardAvoidingView安卓端导航后布局异常问题求助

React Native KeyboardAvoidingView 返回页面后布局异常问题

我在开发应用的「找回密码」流程时碰到了这个问题:

  • 初始状态下用户输入邮箱,KeyboardAvoidingView 在iOS和Android端都能正常适配键盘(见图片1)
  • 但如果键盘处于激活状态时,用户点击「继续」跳转到下一页,返回原页面后,KeyboardAvoidingView 出现异常——输入框会停留在屏幕顶部(见图片2)

额外说明:ForgotPasswordScreen 页面在跳转后返回时不会被卸载。

当前使用的相关代码如下:

<SafeAreaView style={{ flex: 1 }}>
  <KeyboardAvoidingView
    behavior={Platform.OS === "ios" ? "padding" : "height"}
    style={{
      flex: 1,
      justifyContent: "flex-end",
      paddingHorizontal: 20,
    }}
  >
    {children} {/* 此处为页面具体代码 */}
  </KeyboardAvoidingView>
</SafeAreaView>

如果需要更多代码片段可以提供,想问下有没有人遇到过类似的问题?


内容的提问来源于stack exchange,提问作者maxi hraschan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.07.26 00:52:10