如何在 React Native 中设置键盘上方的 TextInput 字段

哈姆扎阿扎姆

在此处输入图片说明在图像中,您可以看到当我按下输入字段时,键盘覆盖了大部分内容,用户无法看到其余的输入字段。我想要一些东西,当用户点击输入字段时,它会同时显示字段和键盘。

这是代码:

**

[![<Container style={styles.background}>
      <Content>
        <View style={styles.placeholderstyle}>
          <Item>
            <Input
              placeholder="Email"
              placeholderTextColor={'rgb(243, 243, 244)'}
              onChangeText={(text) => setEmail(text)}
              value={email}
              style={styles.inputstyle}
            />
          </Item>
          <Item>
            <Input
              placeholder="User Name"
              placeholderTextColor={'rgb(243, 243, 244)'}
              onChangeText={(text) => setName(text)}
              value={user_name}
              style={styles.inputstyle}
            />
          </Item>
          <Item>
            <Input
              placeholder="Password"
              secureTextEntry={true}
              placeholderTextColor={'rgb(243, 243, 244)'}
              onChangeText={(text) => setPassword(text)}
              value={password}
              style={styles.inputstyle}
            />
          </Item>
          <Item>
            <Input
              placeholder="Confirm Password"
              secureTextEntry={true}
              placeholderTextColor={'rgb(243, 243, 244)'}
              onChangeText={(text) => setResetPassword(text)}
              value={resetPassword}
              style={styles.inputstyle}
            />
          </Item>
        </View>
        <Button
          style={styles.btnstyle}
          onPress={() => signinUser(user_name, resetPassword, email, password)}>
          <Text style={styles.btntextstyle}>SignUp</Text>
        </Button>
      </Content>
    </Container>][1]][1]

**

拉斯·玛吉内

您可以使用KeyboardAvoidingView来包装您的代码。这是文档:https : //reactnative.dev/docs/keyboardavoidingview

本文收集自互联网,转载请注明来源。

如有侵权,请联系 [email protected] 删除。

编辑于
0

我来说两句

0 条评论
登录 后参与评论

相关文章

如何在不使用值的情况下设置 TextInput 字段 - React Native

如何在React Native中在TextInput上设置焦点或光标

如何在react-native中设置Onpress On Textinput

单击时如何设置键盘上方的文本输入?React-Native

如何使用react-native在textInput字段中自动采用'/'(斜杠)

如何在React Native中在TextInput上应用点击事件

如何在React Native TextInput中更改光标的宽度?

如何在React Native中验证TextInput值?

如何在React Native中摆脱textInput缩进(填充)?

如何在React Native中将图标放入TextInput中?

如何在React Native中更改TextInput占位符的样式?

如何在React Native中清除TextInput焦点?(Android)

如何在React Native提示中添加其他textInput?

如何在React Native Android中聚焦TextInput

如何在 TextInput 中添加前缀 - React Native

如何在React Native中获取textinput的文本?

如何在 React Native 中更改 TextInput 的值

当在react native中打开键盘时,如何在textinput下面显示组件?

React Native:如何在React Native中发送TextInput的值?

如何在React Native中以Redux形式设置隐藏字段?

当 TextInput 聚焦时,如何防止 React Native 键盘缩小?

React Native中的隐藏TextInput

如何从 TextInput 获取值并使用 Button React Native 进行设置?

在React Native中从AsyncStorage设置TextInput值

如何使用React Native中的引用更改TextInput的值?

如何使用React Native检测TextInput中的退格字符

如何停止在textInput React Native中输入空格?

React Native:此TextInput代码中的onChangeText如何传递值?

如何在 React Native 中将 JSON 响应数组的特定数组索引设置为 TextInput