Skip to content

Commit

Permalink
Restore some guards in ReactFabricGlobalResponderHandler after refact…
Browse files Browse the repository at this point in the history
…or (#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.
  • Loading branch information
rubennorte committed Mar 15, 2023
1 parent cfc1274 commit 47cf4e5
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

const ReactFabricGlobalResponderHandler = {
onChange: function (from: any, to: any, blockNativeResponder: boolean) {
if (from) {
if (from && from.stateNode) {
// equivalent to clearJSResponder
nativeFabricUIManager.setIsJSResponder(
from.stateNode.node,
Expand All @@ -18,7 +18,7 @@ const ReactFabricGlobalResponderHandler = {
);
}

if (to) {
if (to && to.stateNode) {
// equivalent to setJSResponder
nativeFabricUIManager.setIsJSResponder(
to.stateNode.node,
Expand Down

0 comments on commit 47cf4e5

Please sign in to comment.