mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Revert "Merge pull request #5689 from jimfb/cleanup-5151"
This reverts commit067547c1d1, reversing changes made to102cd29189.
This commit is contained in:
@@ -1009,6 +1009,10 @@ ReactDOMComponent.Mixin = {
|
||||
}
|
||||
},
|
||||
|
||||
getNativeNode: function() {
|
||||
return getNode(this);
|
||||
},
|
||||
|
||||
/**
|
||||
* Destroys all event registrations for this instance. Does not remove from
|
||||
* the DOM. That must be done by the parent.
|
||||
@@ -1053,7 +1057,6 @@ ReactDOMComponent.Mixin = {
|
||||
break;
|
||||
}
|
||||
|
||||
var nativeNode = getNode(this);
|
||||
this.unmountChildren();
|
||||
ReactDOMComponentTree.uncacheNode(this);
|
||||
EventPluginHub.deleteAllListeners(this);
|
||||
@@ -1061,7 +1064,6 @@ ReactDOMComponent.Mixin = {
|
||||
this._rootNodeID = null;
|
||||
this._domID = null;
|
||||
this._wrapperState = null;
|
||||
return nativeNode;
|
||||
},
|
||||
|
||||
getPublicInstance: function() {
|
||||
|
||||
@@ -57,10 +57,11 @@ assign(ReactDOMEmptyComponent.prototype, {
|
||||
},
|
||||
receiveComponent: function() {
|
||||
},
|
||||
getNativeNode: function() {
|
||||
return ReactDOMComponentTree.getNodeFromInstance(this);
|
||||
},
|
||||
unmountComponent: function() {
|
||||
var node = ReactDOMComponentTree.getNodeFromInstance(this);
|
||||
ReactDOMComponentTree.uncacheNode(this);
|
||||
return node;
|
||||
},
|
||||
});
|
||||
|
||||
|
||||
@@ -137,10 +137,13 @@ assign(ReactDOMTextComponent.prototype, {
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
getNativeNode: function() {
|
||||
return getNode(this);
|
||||
},
|
||||
|
||||
unmountComponent: function() {
|
||||
var node = getNode(this);
|
||||
ReactDOMComponentTree.uncacheNode(this);
|
||||
return node;
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
@@ -370,6 +370,10 @@ var ReactCompositeComponentMixin = {
|
||||
return markup;
|
||||
},
|
||||
|
||||
getNativeNode: function() {
|
||||
return ReactReconciler.getNativeNode(this._renderedComponent);
|
||||
},
|
||||
|
||||
/**
|
||||
* Releases any resources allocated by `mountComponent`.
|
||||
*
|
||||
@@ -384,7 +388,7 @@ var ReactCompositeComponentMixin = {
|
||||
}
|
||||
|
||||
if (this._renderedComponent) {
|
||||
var unmountedNativeNode = ReactReconciler.unmountComponent(this._renderedComponent);
|
||||
ReactReconciler.unmountComponent(this._renderedComponent);
|
||||
this._renderedNodeType = null;
|
||||
this._renderedComponent = null;
|
||||
this._instance = null;
|
||||
@@ -415,7 +419,6 @@ var ReactCompositeComponentMixin = {
|
||||
// TODO: inst.props = null;
|
||||
// TODO: inst.state = null;
|
||||
// TODO: inst.context = null;
|
||||
return unmountedNativeNode;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -803,7 +806,15 @@ var ReactCompositeComponentMixin = {
|
||||
this._processChildContext(context)
|
||||
);
|
||||
} else {
|
||||
var oldNativeNode = ReactReconciler.unmountComponent(prevComponentInstance);
|
||||
// TODO: This is currently necessary due to the unfortunate caching
|
||||
// that ReactMount does which makes it exceedingly difficult to unmount
|
||||
// a set of siblings without accidentally repopulating the node cache (see
|
||||
// #5151). Once ReactMount no longer stores the nodes by ID, this method
|
||||
// can go away.
|
||||
var oldNativeNode = ReactReconciler.getNativeNode(prevComponentInstance);
|
||||
|
||||
ReactReconciler.unmountComponent(prevComponentInstance);
|
||||
|
||||
this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
|
||||
this._renderedComponent = this._instantiateReactComponent(
|
||||
nextRenderedElement
|
||||
|
||||
@@ -54,6 +54,14 @@ var ReactReconciler = {
|
||||
return markup;
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns a value that can be passed to
|
||||
* ReactComponentEnvironment.replaceNodeWithMarkup.
|
||||
*/
|
||||
getNativeNode: function(internalInstance) {
|
||||
return internalInstance.getNativeNode();
|
||||
},
|
||||
|
||||
/**
|
||||
* Releases any resources allocated by `mountComponent`.
|
||||
*
|
||||
|
||||
@@ -38,6 +38,9 @@ assign(ReactSimpleEmptyComponent.prototype, {
|
||||
},
|
||||
receiveComponent: function() {
|
||||
},
|
||||
getNativeNode: function() {
|
||||
return ReactReconciler.getNativeNode(this._renderedComponent);
|
||||
},
|
||||
unmountComponent: function() {
|
||||
ReactReconciler.unmountComponent(this._renderedComponent);
|
||||
this._renderedComponent = null;
|
||||
|
||||
@@ -104,6 +104,7 @@ function instantiateReactComponent(node) {
|
||||
typeof instance.construct === 'function' &&
|
||||
typeof instance.mountComponent === 'function' &&
|
||||
typeof instance.receiveComponent === 'function' &&
|
||||
typeof instance.getNativeNode === 'function' &&
|
||||
typeof instance.unmountComponent === 'function',
|
||||
'Only React Components can be mounted.'
|
||||
);
|
||||
|
||||
@@ -381,6 +381,10 @@ NoopInternalComponent.prototype = {
|
||||
this._currentElement = element;
|
||||
},
|
||||
|
||||
getNativeNode: function() {
|
||||
return undefined;
|
||||
},
|
||||
|
||||
unmountComponent: function() {
|
||||
},
|
||||
|
||||
|
||||
Reference in New Issue
Block a user