虚拟键盘覆盖了文本输入,我看不到我正在输入的内容。如何避免这种情况?(我尝试使用 KeyboardAwareScrollView 但它仍然覆盖文本输入)。我遇到的另一个问题是关于我的 styles.container 属性 -> justifyContent 和alignItems 的错误 - 它说将它们放在 ScrollView 属性内 - 我不知道如何做到这一点 - 我是 React Native 的新手。
render() {
return (
<KeyboardAwareScrollView>
<View style={styles.container} >
<TextInput
style={styles.input}
underlineColorAndroid="transparent"
placeholder="username"
placeholderTextColor="#00bcd4"
autoCapitalize="none"
secureTextEntry={true}
onChangeText={username => this.setState({ username })}
/>
<View style={styles.btnContainer}>
<TouchableOpacity style={styles.userBtn} onPress={() => this.Login(this.state.email, this.state.password)}>
<Text style={styles.btnTxt}>Login</Text>
</TouchableOpacity>
</View>
</View>
</KeyboardAwareScrollView>
Run Code Online (Sandbox Code Playgroud)
对于 KeyboardAvoidingView 也有同样的事情:
render() {
return (
// <View style={styles.container} >
<KeyboardAvoidingView behavior="padding" style={styles.container}>
<Text style={styles.heading} >Welcome to SelfCare !</Text>
<Image
style={{width: 200, height: 200, …Run Code Online (Sandbox Code Playgroud) android textinput scrollview android-virtual-keyboard react-native