Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

使用DeviceEventEmitter监听键盘调起事件手动控制view 高度避免键盘遮挡内容 #14

Open
febobo opened this issue Jun 14, 2016 · 0 comments

Comments

@febobo
Copy link
Owner

febobo commented Jun 14, 2016

  constructor (props){
    super(props);
    DeviceEventEmitter.addListener('keyboardWillShow', this.keyboardWillShow.bind(this));
    DeviceEventEmitter.addListener('keyboardWillHide', this.keyboardWillHide.bind(this));
  }

  keyboardWillShow (e){
    this.commentView && this.commentView.setNativeProps({
            style: {
                height: commentHeight - e.endCoordinates.height
            }
        })
  }

  keyboardWillHide (){
    this.commentView && this.commentView.setNativeProps({
            style: {
                height: commentHeight
            }
        })
  }  

 componentUnMount(){
    this.keyboardWillHideEvent.remove()
    this.keyboardWillShowEvent.remove()
  }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant