【发布时间】:2018-10-08 17:29:08
【问题描述】:
有没有办法在不使用 redux 的情况下解决这个问题?
这仅在 iOS 上发生,在 android 上,没有它,AddListener 工作得很好。
我有一个组件,我在 componentDidMount 函数上调用 props.navigation.addListener。 一些代码可帮助您准确了解中断的位置:
componentDidMount(){
var _this = this;
this.willBlurListener = this.props.navigation.addListener('willBlur', () => {
_this.timer.clearTimeout();
});
this.willFocusListener = this.props.navigation.addListener('willFocus', () => {
_this._action();
});
AppState.addEventListener('change', this._handleAppStateChange);
}
然后我像这样使用组件:
<Inactivity name='SomeNameView' navigation={ this.props.navigation }>
{this.renderDetails()}
</Inactivity>
【问题讨论】:
-
能否请您分享一些问题所在的代码。
-
刚刚用一些代码sn-ps编辑了
标签: ios iphone react-native react-native-ios react-native-navigation