键盘AvoidingView在IOS上无法按预期工作

键盘AvoidingView在IOS上无法按预期工作,ios,react-native,Ios,React Native,我已经参考了SO和Github上的许多帖子,但是由于用例不同,没有任何东西能够帮助我 正如keyboardavoidingview的官方文档所说,要添加行为,我也这样做了 但是视图没有向上移动,而且我不能使用jutifycontent center,因为我需要仅从顶部开始查看 ///代码 render(){ 返回( 姓名: this.setState({username:value})} /> 电话: this.setState({phonenumber:value}) /> 评论: this

我已经参考了SO和Github上的许多帖子,但是由于用例不同,没有任何东西能够帮助我

正如keyboardavoidingview的官方文档所说,要添加行为,我也这样做了

但是视图没有向上移动,而且我不能使用jutifycontent center,因为我需要仅从顶部开始查看

///代码

render(){
返回(
姓名:
this.setState({username:value})}
/>
电话:
this.setState({phonenumber:value})
/>
评论:
this.setState({comment:value})}
/>
提交
);
}
}
const styles=StyleSheet.create({
容器:{
弹性:1,
背景颜色:“ffffff”,
},
持有者文本:{
尺寸:16,
fontWeight:“粗体”,
玛金托普:5,
边缘左:8,
textAlign:“左”
},
输入框:{
宽度:空,
身高:40,
背景色:“rgba(229229229,0.3)”,
颜色:“000000”,
填充垂直:10,
paddingLeft:10,
差额:10,
边缘左:10,
尺码:18,
边框宽度:0.3,
边界半径:20,
边框颜色:“rgba(175180,43,0.8)”
},
评论框:{
宽度:空,
身高:100,
背景色:“rgba(229229229,0.3)”,
尺寸:12,
颜色:“000000”,
填充垂直:10,
paddingLeft:10,
差额:10,
边缘左:10,
尺码:18,
边框宽度:0.3,
边界半径:20,
textAlignVertical:“顶部”,
边框颜色:“rgba(175180,43,0.8)”
},
按钮:{
宽度:空,
背景色:“1c313a”,
边界半径:25,
差额:15,
填充垂直:15
},
按钮文字:{
尺寸:16,
重量:“500”,
颜色:“ffffff”,
textAlign:“居中”
}
});

忘记本机组件吧,它有很多缺陷

使用这个:

I am using keyboardavoidingview in the following scroll to move up keyboard so that the submit button is always visible. But it seems to not work on ios properly, despite setting the property behavior to padding, please help me sort this out.
  render() {
    return (
      <SafeAreaView style={{flex:1}}>
      <KeyboardAvoidingView
        behavior={Platform.OS === "ios" ? "padding" : null}
        style={styles.container}
       keyboardVerticalOffset={Platform.select({ios: 0, android: Header.HEIGHT + 20})}
      >
       <TouchableWithoutFeedback onPress={Keyboard.dismiss}>
        <View>
          <StatusBar backgroundColor="#7c8500" barStyle="light-content" />
          <View>
            <Text style={styles.holdertext}>Name:</Text>
          </View>
          <TextInput
            style={styles.inputBox}
            underlineColorAndroid="rgba(0,0,0,0)"
            value={this.state.username}
            editable={true}
            placeholderTextColor="rgba(0,0,0,0.3)"
            onChangeText={value => this.setState({ username: value })}
          />
          <View style={styles.bottomView}>
            <Text style={styles.holdertext}>Phone:</Text>
          </View>
          <TextInput
            style={styles.inputBox}
            underlineColorAndroid="rgba(0,0,0,0)"
            value={this.state.phonenumber}
            placeholder="Phone"
            placeholderTextColor="rgba(0,0,0,0.3)"
            maxLength={10}
            keyboardType="phone-pad"
            clearButtonMode="always"
            onChangeText={value => this.setState({ phonenumber: value })}
          />

          <View>
            <Text style={styles.holdertext}>Comment:</Text>
          </View>
          <TextInput
            style={styles.commentbox}
            returnKeyType="next"
            underlineColorAndroid="rgba(0,0,0,0)"
            value={this.state.comment}
            placeholder="Comment"
            placeholderTextColor="rgba(0,0,0,0.3)"
            textAlign={"left"}
            numberOfLines={10}
            multiline={true}
            clearButtonMode="always"
            onChangeText={value => this.setState({ comment: value })}
          />
          <TouchableOpacity style={styles.button} onPress={this.callFun}>
            <Text style={styles.buttonText}>SUBMIT</Text>
          </TouchableOpacity>
        </View>
        </TouchableWithoutFeedback>
      </KeyboardAvoidingView>
      </SafeAreaView>
    );
  }
}
const styles = StyleSheet.create({
  container: {
    flex: 1,
    backgroundColor: "#ffffff",


    },
  holdertext: {
    fontSize: 16,
    fontWeight: "bold",
    marginTop: 5,
    marginLeft: 8,
    textAlign: "left"
  },
  inputBox: {
    width: null,
    height: 40,
    backgroundColor: "rgba(229,229,229,0.3)",
    color: "#000000",
    paddingVertical: 10,
    paddingLeft: 10,
    margin: 10,
    marginLeft: 10,
    fontSize: 18,
    borderWidth: 0.3,
    borderRadius: 20,
    borderColor: "rgba(175,180,43,0.8)"
  },
  commentbox: {
    width: null,
    height:100,
    backgroundColor: "rgba(229,229,229,0.3)",
    fontSize: 12,
    color: "#000000",
    paddingVertical: 10,
    paddingLeft: 10,
    margin: 10,
    marginLeft: 10,
    fontSize: 18,
    borderWidth: 0.3,
    borderRadius: 20,
    textAlignVertical: "top",
    borderColor: "rgba(175,180,43,0.8)"
  },
  button: {
    width: null,
    backgroundColor: "#1c313a",
    borderRadius: 25,
    margin: 15,
    paddingVertical: 15
  },
  buttonText: {
    fontSize: 16,
    fontWeight: "500",
    color: "#ffffff",
    textAlign: "center"
  }
});