From 686b635b7141511a7bbe751430f6680fc5cca2e2 Mon Sep 17 00:00:00 2001 From: Joshua Gross Date: Mon, 12 Apr 2021 11:10:51 -0700 Subject: [PATCH] Prevent reading canonical property of null (#21242) * Prevent reading canonical property of null * prettier --- .../src/ReactFabricGlobalResponderHandler.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js b/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js index 68a0b424ba34b..e9aae2e4fd265 100644 --- a/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js +++ b/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js @@ -13,7 +13,10 @@ import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateI const ReactFabricGlobalResponderHandler = { onChange: function(from: any, to: any, blockNativeResponder: boolean) { const fromOrTo = from || to; - const isFabric = !!fromOrTo.stateNode.canonical._internalInstanceHandle; + const fromOrToStateNode = fromOrTo && fromOrTo.stateNode; + const isFabric = !!( + fromOrToStateNode && fromOrToStateNode.canonical._internalInstanceHandle + ); if (isFabric) { // Noop for now until setJSResponder/clearJSResponder are supported in Fabric