【问题标题】:How to set TextInput fields above the keyboard in React Native如何在 React Native 中设置键盘上方的 TextInput 字段
【发布时间】:2020-07-02 10:56:12
【问题描述】:

Here 在图像中,您可以看到当我按下输入字段时,键盘覆盖了大部分内容,而用户看不到其余的输入字段。我想要一些东西,当用户点击输入字段时,它会轻微显示字段和键盘。

代码如下:

**

[![<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]

**

【问题讨论】:

  • 我认为问题的图像丢失了
  • @HaykShakhbazyan 抱歉我已经编辑了问题知道你可以看到图片

标签: reactjs react-native react-native-android native native-base


【解决方案1】:

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

【讨论】:

    猜你喜欢
    • 2020-06-09
    • 2015-12-16
    • 1970-01-01
    • 2019-09-15
    • 2020-11-23
    • 2016-04-19
    • 1970-01-01
    • 2021-01-25
    • 1970-01-01
    相关资源
    最近更新 更多