[英]react-native TextInput displays wrong when changing height on Android
[英]React Native android TextInput disappears under keyboard when changing to emoticons
我们将TextInput
包装在KeyboardAvoidingView
中,并且一切正常,直到有人更改键盘以选择表情符号。 然后键盘的大小发生变化并覆盖TextInput
。
然后可以写一个表情符号,但用户再也看不到他/她的文本发生了什么。
这是我们的代码:
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",
},
});
我们正在使用带有 expo SDK44 的本机反应。 您看到的 GIF 来自诺基亚 Android 版本 10 上的测试飞行二进制文件。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.