Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 2 additions & 4 deletions src/renderers/dom/shared/ReactDOMComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -996,10 +996,6 @@ 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.
Expand Down Expand Up @@ -1044,13 +1040,15 @@ ReactDOMComponent.Mixin = {
break;
}

var nativeNode = getNode(this);
this.unmountChildren();
ReactDOMComponentTree.uncacheNode(this);
EventPluginHub.deleteAllListeners(this);
ReactComponentBrowserEnvironment.unmountIDFromEnvironment(this._rootNodeID);
this._rootNodeID = null;
this._domID = null;
this._wrapperState = null;
return nativeNode;
},

getPublicInstance: function() {
Expand Down
5 changes: 2 additions & 3 deletions src/renderers/dom/shared/ReactDOMEmptyComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,10 @@ assign(ReactDOMEmptyComponent.prototype, {
},
receiveComponent: function() {
},
getNativeNode: function() {
return ReactDOMComponentTree.getNodeFromInstance(this);
},
unmountComponent: function() {
var node = ReactDOMComponentTree.getNodeFromInstance(this);
ReactDOMComponentTree.uncacheNode(this);
return node;
},
});

Expand Down
7 changes: 2 additions & 5 deletions src/renderers/dom/shared/ReactDOMTextComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,10 @@ assign(ReactDOMTextComponent.prototype, {
}
}
},

getNativeNode: function() {
return getNode(this);
},

unmountComponent: function() {
var node = getNode(this);
ReactDOMComponentTree.uncacheNode(this);
return node;
},

});
Expand Down
17 changes: 3 additions & 14 deletions src/renderers/shared/reconciler/ReactCompositeComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -371,10 +371,6 @@ var ReactCompositeComponentMixin = {
return markup;
},

getNativeNode: function() {
return ReactReconciler.getNativeNode(this._renderedComponent);
},

/**
* Releases any resources allocated by `mountComponent`.
*
Expand All @@ -389,7 +385,7 @@ var ReactCompositeComponentMixin = {
}

if (this._renderedComponent) {
ReactReconciler.unmountComponent(this._renderedComponent);
var unmountedNativeNode = ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedNodeType = null;
this._renderedComponent = null;
this._instance = null;
Expand Down Expand Up @@ -420,6 +416,7 @@ var ReactCompositeComponentMixin = {
// TODO: inst.props = null;
// TODO: inst.state = null;
// TODO: inst.context = null;
return unmountedNativeNode;
},

/**
Expand Down Expand Up @@ -807,15 +804,7 @@ var ReactCompositeComponentMixin = {
this._processChildContext(context)
);
} else {
// 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);

var oldNativeNode = ReactReconciler.unmountComponent(prevComponentInstance);
this._renderedNodeType = ReactNodeTypes.getType(nextRenderedElement);
this._renderedComponent = this._instantiateReactComponent(
nextRenderedElement
Expand Down
8 changes: 0 additions & 8 deletions src/renderers/shared/reconciler/ReactReconciler.js
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,6 @@ 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`.
*
Expand Down
3 changes: 0 additions & 3 deletions src/renderers/shared/reconciler/ReactSimpleEmptyComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,6 @@ assign(ReactSimpleEmptyComponent.prototype, {
},
receiveComponent: function() {
},
getNativeNode: function() {
return ReactReconciler.getNativeNode(this._renderedComponent);
},
unmountComponent: function() {
ReactReconciler.unmountComponent(this._renderedComponent);
this._renderedComponent = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,6 @@ 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.'
);
Expand Down
4 changes: 0 additions & 4 deletions src/test/ReactTestUtils.js
Original file line number Diff line number Diff line change
Expand Up @@ -381,10 +381,6 @@ NoopInternalComponent.prototype = {
this._currentElement = element;
},

getNativeNode: function() {
return undefined;
},

unmountComponent: function() {
},

Expand Down