键盘避免视图高度不足

时间:2019-10-06 06:50:07

标签: react-native

键盘将“ CreateComment”组件推到顶部,但高度不够,它仍然隐藏了其中包含“ InputText”的“ CreateComment”组件。

     <ScrollView >
                 ....
      </ScrollView> 

     <KeyboardAvoidingView behavior='position'>
      <View  style={styles.footer}>
       <CreateComment GetComments={()=>this.GetComments()}
        roomId={this.state.postID} />
       </View>
      </KeyboardAvoidingView> 

</View>

这是stlye:

container: {
flex: 1, 
},
footer :{ 
 position:'absolute',
 bottom:0 },
...

1 个答案:

答案 0 :(得分:1)

您可以更改要指定自己的高度。

您可以使用offset

示例

<KeyboardAvoidingView
          behavior="position"
          keyboardVerticalOffset={100}
        >