gpt4 book ai didi

android - 键盘隐藏 Android React Native webview 的内容

转载 作者:行者123 更新时间:2023-12-02 16:02:05 24 4
gpt4 key购买 nike

我正在使用React Native的<WebView>组件。

documentation没有提到当 webview 的 HTML 包含 <input> 时如何处理隐藏 webview 的键盘这在 Android 中成为焦点。

有人解决这个问题了吗?我找到了一个似乎适用于常规 <View> 的库,但不是<WebView> .

最佳答案

你可以用 KeyboardAvoidingView 包装你的 WebView

  <KeyboardAvoidingView
behavior={Platform.select({ ios: "position", android: null })}
enabled
contentContainerStyle={{ flex: 1 }}
keyboardVerticalOffset={Platform.select({ ios: offset, android: 20 })}
style={{ flexGrow: 1 }}
>
<WebView/>
</KeyboardAvoidingView>

关于android - 键盘隐藏 Android React Native webview 的内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/37697742/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com