react-native/Libraries/ReactIOS/ReactIOSGlobalResponderHand...

30 lines
840 B
JavaScript
Raw Normal View History

/**
* Copyright (c) 2015-present, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @providesModule ReactIOSGlobalResponderHandler
2015-03-25 01:33:05 +00:00
* @flow
*/
'use strict';
var RCTUIManager = require('NativeModules').UIManager;
var ReactIOSTagHandles = require('ReactIOSTagHandles');
var ReactIOSGlobalResponderHandler = {
2015-03-25 01:33:05 +00:00
onChange: function(from: string, to: string) {
if (to !== null) {
2015-03-17 10:08:46 +00:00
RCTUIManager.setJSResponder(
ReactIOSTagHandles.mostRecentMountedNodeHandleForRootNodeID(to)
);
} else {
2015-03-17 10:08:46 +00:00
RCTUIManager.clearJSResponder();
}
}
};
module.exports = ReactIOSGlobalResponderHandler;