Restore some guards in ReactFabricGlobalResponderHandler after refactor (#26394)
## Summary I refactored this code in #26290 but forgot to add guards when the fiber or the state node where null, and this is typed as `any` so Flow didn't catch it. This restores the same logic to guard against null. ## How did you test this change? Existing tests.
Rubén Norte committed
Mar 15, 2023 at 10:30 UTC
47cf4e578c2d8eef9c6cc27105ce560307999244
1 file changed
+2
-2
packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js
+2
-2
@@ -9,7 +9,7 @@
9
10
const ReactFabricGlobalResponderHandler = {
11
onChange: function (from: any, to: any, blockNativeResponder: boolean) {
12
- if (from) {
12
+ if (from && from.stateNode) {
13
// equivalent to clearJSResponder
14
nativeFabricUIManager.setIsJSResponder(
15
from.stateNode.node,
@@ -18,7 +18,7 @@ const ReactFabricGlobalResponderHandler = {
18
);
19
}
20
21
- if (to) {
21
+ if (to && to.stateNode) {
22
// equivalent to setJSResponder
23
nativeFabricUIManager.setIsJSResponder(
24
to.stateNode.node,