我正在尝试从keyboardDidHide
内部的props访问函数,但是我需要延迟工作:
componentDidMount() {
this.keyboardDidHideListener = Keyboard.addListener(
'keyboardDidHide',
() => this._keyboardDidHide(),
);
}
_keyboardDidHide() {
setTimeout(function() {
this.props.closeModal();
}, 500);
}
但是当我关闭键盘时:
TypeError: undefined is not an object (evaluating 'this.props')
但是,如果我删除,超时效果很好。如何在延迟内执行我的this.props.closeModal()
?