Skip to content

Commit 2fbb370

Browse files
committed
Update to not use _mountImage
See facebook/react#852.
1 parent 9815c79 commit 2fbb370

File tree

1 file changed

+13
-4
lines changed

1 file changed

+13
-4
lines changed

src/ReactART.js

Lines changed: 13 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,10 +109,11 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
109109
* Creates a child component.
110110
*
111111
* @param {ReactComponent} child Component to create.
112+
* @param {object} childNode ART node to insert.
112113
* @protected
113114
*/
114-
createChild: function(child) {
115-
var childNode = child._mountImage;
115+
createChild: function(child, childNode) {
116+
child._mountImage = childNode;
116117
var mostRecentlyPlacedChild = this._mostRecentlyPlacedChild;
117118
if (mostRecentlyPlacedChild == null) {
118119
// I'm supposed to be first.
@@ -140,6 +141,7 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
140141
*/
141142
removeChild: function(child) {
142143
child._mountImage.eject();
144+
child._mountImage = null;
143145
},
144146

145147
/**
@@ -162,8 +164,15 @@ var ContainerMixin = merge(ReactMultiChild.Mixin, {
162164
children,
163165
transaction
164166
);
165-
for (var i = 0; i < mountedImages.length; i++) {
166-
mountedImages[i].inject(this.node);
167+
// Each mount image corresponds to one of the flattened children
168+
var i = 0;
169+
for (var key in this._renderedChildren) {
170+
if (this._renderedChildren.hasOwnProperty(key)) {
171+
var child = this._renderedChildren[key];
172+
child._mountImage = mountedImages[i];
173+
mountedImages[i].inject(this.node);
174+
i++;
175+
}
167176
}
168177
}
169178

0 commit comments

Comments
 (0)