window.addEventListener('storage', e => {
if(e.key === 'access_token' && e.oldValue && !e.newValue) {
store.dispatch(userSignOut());
}
})
如果这是一个合适的解决方案,那么我应该将其粘贴到哪里(生命周期事件?]
尝试使用焦点侦听器isFocused
也请检查
反应导航向订阅它们的屏幕组件发出事件:
willFocus - the screen will focus
didFocus - the screen focused (if there was a transition, the transition
completed)
willBlur - the screen will be unfocused
didBlur - the screen unfocused (if there was a transition, the transition
completed)