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
相关产品推荐
相关产品推荐

