【问题标题】:The virtual keyboard shifts all my content up the same distance, and some text fields are not visible when I type (Android)虚拟键盘将我的所有内容向上移动相同的距离,并且在我键入时某些文本字段不可见(Android)
【发布时间】:2019-12-04 14:59:11
【问题描述】:

我试图不将虚拟键盘放在键盘上方,对于它工作的最后一个字段,但对于第一个字段,它将它们全部移动到打字时看不到的点。我正在使用本机基础

看gif就明白了。

这是我的代码

  return (
    <KeyboardAvoidingView behavior="position">
      <ScrollView>
        <Form>
          <Item floatingLabel error={validateForm()}>
            <Label>Correo</Label>
            <Input onChange={e => handldeOnChange("email", e)} />
            <Icon active name="person" style={STYLES.colorIcon} />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Item floatingLabel error={validateForm()}>
            <Label>Contraseña</Label>
            <Icon active name="lock" style={STYLES.colorIcon} />
            <Input
              onChange={e => handldeOnChange("password", e)}
              secureTextEntry={true}
            />
          </Item>
          <Button
            block
            button
            style={styles.buttonLogin}
            onPress={() => handlerLogin()}
            disabled={validateForm()}
          >
            <Text>Ingresar</Text>
          </Button>
        </Form>
      </ScrollView>
    </KeyboardAvoidingView>
  );

const styles = StyleSheet.create({

  containerLogin: {
    justifyContent: "center",
    flex: 1,
    paddingHorizontal: 40
  },
  buttonLogin: {
    marginTop: 30
  }
});

谢谢

【问题讨论】:

    标签: react-native


    【解决方案1】:

    尝试这样放置键盘项目:

    &lt;KeyboardAvoidingView behavior="padding" enabled&gt;

    【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-11-15
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-07-07
    • 1970-01-01
    相关资源
    最近更新 更多