This repository was archived by the owner on Dec 3, 2022. It is now read-only.
File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -34,9 +34,10 @@ export function useNavigationEvents(handleEvt) {
34
34
} ,
35
35
// For TODO consideration: If the events are tied to the navigation object and the key
36
36
// identifies the nav object, then we should probably pass [navigation.state.key] here, to
37
- // make sure react doesn't needlessly detach and re-attach this effect. Need more thorough
38
- // testing to be sure..
37
+ // make sure react doesn't needlessly detach and re-attach this effect. In practice this
38
+ // seems to cause troubles
39
39
undefined
40
+ // [navigation.state.key]
40
41
) ;
41
42
}
42
43
@@ -60,8 +61,10 @@ function focusStateOfEvent(eventName) {
60
61
return willFocusState ;
61
62
case 'willBlur' :
62
63
return willBlurState ;
63
- default :
64
+ case 'didBlur' :
64
65
return didBlurState ;
66
+ default :
67
+ return null ;
65
68
}
66
69
}
67
70
@@ -70,7 +73,8 @@ export function useFocusState() {
70
73
const isFocused = navigation . isFocused ( ) ;
71
74
const [ focusState , setFocusState ] = useState ( getInitialFocusState ( isFocused ) ) ;
72
75
function handleEvt ( e ) {
73
- setFocusState ( focusStateOfEvent ( e . type ) ) ;
76
+ const newState = focusStateOfEvent ( e . type ) ;
77
+ newState && setFocusState ( newState ) ;
74
78
}
75
79
useNavigationEvents ( handleEvt ) ;
76
80
return focusState ;
You can’t perform that action at this time.
0 commit comments