KeyboardAvoidingView - 可以将输入包装在其他视图中吗?

时间:2018-02-06 11:00:35

标签: ios react-native

当我将输入包装在其他视图周围时,KeyboardAvoidingView似乎根本不起作用。一般情况下输入必须是裸的,没有任何容器吗?

return (

  <KeyboardAvoidingView
    style={{ backgroundColor: '#fff', flex: 1 }}
    behavior="padding"
  >


    <View style={{ paddingTop: 30, paddingBottom: 10 }}>
    <Text style={styles.regularTextStyle}> Twój email </Text>
    </View>


    <CardInput>
        <Input
          label="email"
          placeholder="jan.kowalski@gmail.com"
          value={this.props.email}
          onChangeText={text => this.props.dataUpdate({ prop: 'email', value: text })}
        />
      </CardInput>


      <View style={{ paddingTop: 60, paddingBottom: 10 }}>
      <Text style={styles.regularTextStyle}> Adres sklepu</Text>
      </View>


      <CardInput>
        <Input
          placeholder="miasto"
          value={this.props.city}
          onChangeText={text => this.props.dataUpdate({ prop: 'city', value: text })}
        />
    </CardInput>
    <CardInput>

          <Input
            placeholder="ulica"
            value={this.props.street}
            onChangeText={text => this.props.dataUpdate({ prop: 'street', value: text })}
            style={{ flex: 3 }}
          />


          <Input
            placeholder="nr"
            value={this.props.number}
            onChangeText={text => this.props.dataUpdate({ prop: 'number', value: text })}
            style={{ flex: 1, marginLeft: 15 }}
          />
      </CardInput>

      {this.renderButton()}

    <View style={{ height: 60 }} />
</KeyboardAvoidingView>

);

enter image description here

并且在弹出键盘后,视图根本不会显示

enter image description here

0 个答案:

没有答案