在 react native 的绝对视图中插入文本输入时处理键盘



基本上,我有一个绝对视图的登录屏幕,其中包含用户名和密码的文本输入组件。当键盘弹出时,它涵盖了输入字段。到目前为止,我已经浏览了其他问题和教程,但我找不到如何处理这种情况。

我认为键盘不会覆盖所有输入字段——顶部至少有一个输入字段是可见的。

试试这个,将焦点放在下一个文本输入上提交编辑最后一个。

<TextInput 
  style = {styles.titleInput}
  returnKeyType = {"next"}
  autoFocus = {true}
  placeholder = "Title"
  onSubmitEditing={(event) => { 
    this.refs.SecondInput.focus(); 
  }}
/>
<TextInput
  ref='SecondInput'
  style = {styles.descriptionInput}          
  multiline = {true}
  maxLength = {200}
  placeholder = "Description" />

最新更新