Skip to content

Remove unnecessary (and incorrect) code for compatibility with Paper in the Fabric version of GlobalResponderHandler #26290

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

Merged
Merged
Changes from all commits
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 @@ -7,42 +7,24 @@
* @flow
*/

// Module provided by RN:
import {UIManager} from 'react-native/Libraries/ReactPrivate/ReactNativePrivateInterface';

const ReactFabricGlobalResponderHandler = {
onChange: function (from: any, to: any, blockNativeResponder: boolean) {
const fromOrTo = from || to;
const fromOrToStateNode = fromOrTo && fromOrTo.stateNode;
const isFabric = !!(
fromOrToStateNode && fromOrToStateNode.canonical._internalInstanceHandle
);

if (isFabric) {
if (from) {
// equivalent to clearJSResponder
nativeFabricUIManager.setIsJSResponder(
from.stateNode.node,
false,
blockNativeResponder || false,
);
}
if (from) {
// equivalent to clearJSResponder
nativeFabricUIManager.setIsJSResponder(
from.stateNode.node,
false,
blockNativeResponder || false,
);
}

if (to) {
// equivalent to setJSResponder
nativeFabricUIManager.setIsJSResponder(
to.stateNode.node,
true,
blockNativeResponder || false,
);
}
} else {
if (to !== null) {
const tag = to.stateNode.canonical._nativeTag;
UIManager.setJSResponder(tag, blockNativeResponder);
} else {
UIManager.clearJSResponder();
}
if (to) {
// equivalent to setJSResponder
nativeFabricUIManager.setIsJSResponder(
to.stateNode.node,
true,
blockNativeResponder || false,
);
}
},
};
Expand Down