【发布时间】:2021-06-13 21:52:16
【问题描述】:
我想为聊天应用创建一个 TextInput。在 Ios 上一切正常,但在 Android 上,如果打开键盘,TextInput 会被覆盖:
我的代码如下所示:
<KeyboardAvoidingView enabled behavior={Platform.OS == 'ios' ? 'padding' : null} keyboardVerticalOffset={Platform.OS == 'ios' ? null : 90} style={{felx: 1, width: "100%", flexDirection: "row", alignItems: "center", marginVertical: 5, justifyContent: "center" }}>
<TouchableOpacity>
...
</TouchableOpacity>
<TextInput style={{
height: 47,
width: "80%",
backgroundColor: "#fff",
paddingHorizontal: 10,
borderRadius: 14,
color: "grey",
fontSize: 17,
}}
editable={this.state.inputdisabled}
placeholder={"Nachricht..."}
value={nachricht}
blur={true}
blurOnSubmit={false}
multiline
clearButtonMode='always'
onChangeText={text => this.setState({nachricht: text})}
/>
<TouchableOpacity>
..
</TouchableOpacity>
</KeyboardAvoidingView>
【问题讨论】:
标签: android react-native keyboard expo