0

嗨,我设计了一个注册页面,为此我编写了这样的代码

inputFocused (refName) {
  let android = Platform.OS == 'android'
    if(Platform.OS == android){
    let scrollResponder = this.refs.scrollView.getScrollResponder();
    scrollResponder.scrollTo({y: windowSize.height/4})
    }
    else{
     let scrollResponder = this.refs.scrollView.getScrollResponder();
    scrollResponder.scrollTo({y: windowSize.height/3})
    }

}
render{
  return(
     <TextInput
                             ref='SixthInput'
                             style={styles.textInput1}
                             secureTextEntry={true}
                             placeholder="Confirm Your Password"
                              returnKeyType='done'
                              value={this.state.confirmpassword}
                              onSubmitEditing={(event)=>{
                                        this.onRegister(); 
                                      }}
                           onFocus={this.inputFocused.bind(this, 'confirmpassword')}
                             onChange={this.handleChange.bind(this,'confirmpassword')}/>
  )
}

这里面临的问题是,当在焦点上单击 textInput 时,我正在向上滚动视图,我在导航栏下方编写了滚动视图,当单击 Textinput 时,它向上滚动视图,在 IOS 中我的代码工作正常,但在android 当键盘出现时,它会向上移动总视图,下面附上我面临的问题的图像 在此处输入图像描述

任何人都可以给我建议如何解决它,非常感谢任何帮助

4

0 回答 0