Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent reading canonical property of null #21242

Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,8 @@ import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateI
const ReactFabricGlobalResponderHandler = {
onChange: function(from: any, to: any, blockNativeResponder: boolean) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a plan to flow type this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Surprisingly "handles" like this seem to be consistently any-typed in the ReactNativeRenderer and in the Fabric renderer. So I guess I'm just going to leave as any for now? Seems odd

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
Expand Down