[英]React Native android TextInput disappears under keyboard when changing to emoticons
We wrapped our TextInput
inside the KeyboardAvoidingView
and all works fine until one changes the keyboard to choose an emoticon.我们将TextInput
包装在KeyboardAvoidingView
中,并且一切正常,直到有人更改键盘以选择表情符号。 The size of the keyboard changes then and covers the TextInput
.然后键盘的大小发生变化并覆盖TextInput
。
It is possible then to write an emoticon but the user can't see anymore what is going on with his/her text.然后可以写一个表情符号,但用户再也看不到他/她的文本发生了什么。
Here's our code:这是我们的代码:
const headerHeight = useHeaderHeight();
... ...
<KeyboardAvoidingView
behavior={Platform.OS == "ios" ? "padding" : "height"}
keyboardVerticalOffset={headerHeight}
style={styles.screen}
>
<ScrollView keyboardShouldPersistTaps="handled">
<View style={styles.radContainer}>
<TextInput
style={styles.addCommentInput}
value={comment}
onChangeText={changeCommentHandler}
onSubmitEditing={() => {
sendCommentHandler();
}}
/>
</View>
</ScrollView>
</KeyboardAvoidingView>
... ...
const styles = StyleSheet.create({
screen: {
alignContent: "space-between",
backgroundColor: styleConstants.colors.silver03,
flex: 1,
marginBottom: 10,
},
radContainer: {
padding: 10,
},
addCommentInput: {
backgroundColor: "#fff",
borderColor: styleConstants.colors.silver01,
borderRadius: 8,
borderWidth: 1,
fontFamily: "work-sans_regular",
fontSize: 14,
height: 40,
paddingBottom: 8,
paddingLeft: 10,
paddingRight: 10,
paddingTop: 8,
textAlignVertical: "center",
},
});
We're using react native with expo SDK44.我们正在使用带有 expo SDK44 的本机反应。 The GIF you see is from a test flight binary on a Nokia Android version 10.您看到的 GIF 来自诺基亚 Android 版本 10 上的测试飞行二进制文件。
this problem is related with React Native, here's the PR in Github , it is merged but not active in current version of React Native 0.70.6, you can add the fixed code manually and maintain validity until it is added to RN, using patch-package这个问题与React Native有关,这里是Github中的PR,它在当前版本的React Native 0.70.6中已合并但未激活,您可以手动添加固定代码并保持有效性,直到它被添加到RN,使用补丁-包裹
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.