@samitouri / QOS-React-2 / commits / c80570b016

Synced ReactNativeFiber bugfix for leaf-node children (#9330)

Brian Vaughn committed Apr 5, 2017 at 11:29 UTC c80570b0167711377b8e836eebd3c0a21dbb14f7
1 file changed +13 -4
src/renderers/native/ReactNativeFiber.js
+13 -4
@@ -72,11 +72,16 @@ const NativeRenderer = ReactFiberReconciler({
72 parentInstance: Instance | Container,
73 child: Instance | TextInstance,
74 ): void {
75 +
76 + const childTag = typeof child === 'number'
77 + ? child
78 + : child._nativeTag;
79 +
80 if (typeof parentInstance === 'number') {
81 // Root container
82 UIManager.setChildren(
83 parentInstance, // containerTag
79 - [(child: any)._nativeTag], // reactTags
84 + [childTag], // reactTags
85 );
86 } else {
87 const children = parentInstance._children;
@@ -87,7 +92,7 @@ const NativeRenderer = ReactFiberReconciler({
92 parentInstance._nativeTag, // containerTag
93 [], // moveFromIndices
94 [], // moveToIndices
90 - [(child: any)._nativeTag], // addChildReactTags
95 + [childTag], // addChildReactTags
96 [children.length - 1], // addAtIndices
97 [], // removeAtIndices
98 );
@@ -141,7 +146,7 @@ const NativeRenderer = ReactFiberReconciler({
146 );
147
148 UIManager.updateView(
144 - (instance: any)._nativeTag, // reactTag
149 + instance._nativeTag, // reactTag
150 viewConfig.uiViewClassName, // viewName
151 updatePayload, // props
152 );
@@ -282,11 +287,15 @@ const NativeRenderer = ReactFiberReconciler({
287 } else {
288 children.splice(beforeChildIndex, 0, child);
289
290 + const childTag = typeof child === 'number'
291 + ? child
292 + : child._nativeTag;
293 +
294 UIManager.manageChildren(
295 (parentInstance: any)._nativeTag, // containerID
296 [], // moveFromIndices
297 [], // moveToIndices
289 - [(child: any)._nativeTag], // addChildReactTags
298 + [childTag], // addChildReactTags
299 [beforeChildIndex], // addAtIndices
300 [], // removeAtIndices
301 );