diff --git a/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js b/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js index 90b94295a09f4..10ac51d4317d6 100644 --- a/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js +++ b/packages/react-native-renderer/src/ReactFabricGlobalResponderHandler.js @@ -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, + ); } }, };