Skip to content

Commit 686b635

Browse files
authored
Prevent reading canonical property of null (#21242)
* Prevent reading canonical property of null * prettier
1 parent dd8552a commit 686b635

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,10 @@ import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateI
1313
const ReactFabricGlobalResponderHandler = {
1414
onChange: function(from: any, to: any, blockNativeResponder: boolean) {
1515
const fromOrTo = from || to;
16-
const isFabric = !!fromOrTo.stateNode.canonical._internalInstanceHandle;
16+
const fromOrToStateNode = fromOrTo && fromOrTo.stateNode;
17+
const isFabric = !!(
18+
fromOrToStateNode && fromOrToStateNode.canonical._internalInstanceHandle
19+
);
1720

1821
if (isFabric) {
1922
// Noop for now until setJSResponder/clearJSResponder are supported in Fabric

0 commit comments

Comments
 (0)