【发布时间】:2019-07-27 12:35:37
【问题描述】:
我有一个面板,其中键盘始终处于打开状态,因为我不希望用户关闭它。在那个面板中,我有一个 FlatList,它看起来像这样:
<KeyboardAvoidingView style={{ flex: 1 }}>
<FlatList
// This keeps the keyboard up and disables the user's ability to hide it.
keyboardShouldPersistTaps="handled"
data={this.state.examples}
keyExtractor={(item, index) => index.toString()}
renderItem={this._renderItem}
contentContainerStyle={{ flex: 1}}
/>
</KeyboardAvoidingView>
到目前为止一切顺利,我已经实现了我想要的。但是,当键盘启动时 - 它隐藏了 FlatList 呈现的项目的底部。用户无法向上滚动并查看最后的项目,因为他们停留在键盘后面。
如何在能够查看和滚动 FlatList 的全部内容的同时保留打开的键盘(并禁用被关闭的功能)?
【问题讨论】:
-
您可以尝试将 android:windowSoftInputMode="adjustPan" 添加到您的活动选项卡到您的 androidManifest.xml 中吗?
-
@Kornflexx 我在 iOS 上遇到了这个问题。
标签: javascript react-native keyboard scrollview