mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
92b7b172cc
* Convert EventPlugin{Hub,Registry} to named exports
* Convert EventPluginUtils to named exports
* Convert EventPropagators to named exports
* Convert ReactControlledComponent to named exports
* Convert ReactGenericBatching to named exports
* Convert ReactDOMComponentTree to named exports
* Convert ReactNativeComponentTree to named exports
* Convert ReactNativeRTComponentTree to named exports
* Convert FallbackCompositionState to named exports
* Convert ReactEventEmitterMixin to named exports
* Convert ReactBrowserEventEmitter to named exports
* Convert ReactNativeEventEmitter to named exports
* Convert ReactDOMEventListener to named exports
* Convert DOMMarkupOperations to named exports
* Convert DOMProperty to named exports
* Add suppression for existing Flow violation
Flow didn't see it before.
* Update sizes
45 lines
1.0 KiB
JavaScript
45 lines
1.0 KiB
JavaScript
/**
|
|
* Copyright (c) 2013-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.
|
|
*/
|
|
|
|
import invariant from 'fbjs/lib/invariant';
|
|
|
|
var instanceCache = {};
|
|
var instanceProps = {};
|
|
|
|
export function precacheFiberNode(hostInst, tag) {
|
|
instanceCache[tag] = hostInst;
|
|
}
|
|
|
|
export function uncacheFiberNode(tag) {
|
|
delete instanceCache[tag];
|
|
delete instanceProps[tag];
|
|
}
|
|
|
|
function getInstanceFromTag(tag) {
|
|
return instanceCache[tag] || null;
|
|
}
|
|
|
|
function getTagFromInstance(inst) {
|
|
var tag = inst.stateNode._nativeTag;
|
|
invariant(tag, 'All native instances should have a tag.');
|
|
return tag;
|
|
}
|
|
|
|
export {
|
|
getInstanceFromTag as getClosestInstanceFromNode,
|
|
getInstanceFromTag as getInstanceFromNode,
|
|
getTagFromInstance as getNodeFromInstance,
|
|
};
|
|
|
|
export function getFiberCurrentPropsFromNode(stateNode) {
|
|
return instanceProps[stateNode._nativeTag] || null;
|
|
}
|
|
|
|
export function updateFiberProps(tag, props) {
|
|
instanceProps[tag] = props;
|
|
}
|