mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
setJSResponder in Fabric renderer (#13031)
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
*/
|
||||
|
||||
// Module provided by RN:
|
||||
import UIManager from 'UIManager';
|
||||
|
||||
const ReactFabricGlobalResponderHandler = {
|
||||
onChange: function(from: any, to: any, blockNativeResponder: boolean) {
|
||||
if (to !== null) {
|
||||
const tag = to.stateNode.canonical._nativeTag;
|
||||
UIManager.setJSResponder(tag, blockNativeResponder);
|
||||
} else {
|
||||
UIManager.clearJSResponder();
|
||||
}
|
||||
},
|
||||
};
|
||||
|
||||
export default ReactFabricGlobalResponderHandler;
|
||||
@@ -11,5 +11,11 @@ import './ReactNativeInjectionShared';
|
||||
|
||||
import * as ReactFabricComponentTree from './ReactFabricComponentTree';
|
||||
import * as EventPluginUtils from 'events/EventPluginUtils';
|
||||
import ReactFabricGlobalResponderHandler from './ReactFabricGlobalResponderHandler';
|
||||
import ResponderEventPlugin from 'events/ResponderEventPlugin';
|
||||
|
||||
EventPluginUtils.injection.injectComponentTree(ReactFabricComponentTree);
|
||||
|
||||
ResponderEventPlugin.injection.injectGlobalResponderHandler(
|
||||
ReactFabricGlobalResponderHandler,
|
||||
);
|
||||
|
||||
@@ -12,6 +12,8 @@ import './ReactNativeInjectionShared';
|
||||
import * as ReactNativeComponentTree from './ReactNativeComponentTree';
|
||||
import * as EventPluginUtils from 'events/EventPluginUtils';
|
||||
import * as ReactNativeEventEmitter from './ReactNativeEventEmitter';
|
||||
import ReactNativeGlobalResponderHandler from './ReactNativeGlobalResponderHandler';
|
||||
import ResponderEventPlugin from 'events/ResponderEventPlugin';
|
||||
|
||||
// Module provided by RN:
|
||||
import RCTEventEmitter from 'RCTEventEmitter';
|
||||
@@ -22,3 +24,7 @@ import RCTEventEmitter from 'RCTEventEmitter';
|
||||
RCTEventEmitter.register(ReactNativeEventEmitter);
|
||||
|
||||
EventPluginUtils.injection.injectComponentTree(ReactNativeComponentTree);
|
||||
|
||||
ResponderEventPlugin.injection.injectGlobalResponderHandler(
|
||||
ReactNativeGlobalResponderHandler,
|
||||
);
|
||||
|
||||
@@ -21,17 +21,12 @@ import ResponderEventPlugin from 'events/ResponderEventPlugin';
|
||||
|
||||
import ReactNativeBridgeEventPlugin from './ReactNativeBridgeEventPlugin';
|
||||
import ReactNativeEventPluginOrder from './ReactNativeEventPluginOrder';
|
||||
import ReactNativeGlobalResponderHandler from './ReactNativeGlobalResponderHandler';
|
||||
|
||||
/**
|
||||
* Inject module for resolving DOM hierarchy and plugin ordering.
|
||||
*/
|
||||
EventPluginHub.injection.injectEventPluginOrder(ReactNativeEventPluginOrder);
|
||||
|
||||
ResponderEventPlugin.injection.injectGlobalResponderHandler(
|
||||
ReactNativeGlobalResponderHandler,
|
||||
);
|
||||
|
||||
/**
|
||||
* Some important event plugins included by default (without having to require
|
||||
* them).
|
||||
|
||||
Reference in New Issue
Block a user