Fix TextInput in React Nodes

Summary:
@public Relax the constraint on ReactTextInputManager.
The TextInput Advanced screen looked different with and without
nodes, namely child Text items were not being rendered on the Nodes version.
This patch fixes that.

Differential Revision: D2930800
This commit is contained in:
Ahmed El-Helw
2016-02-12 20:16:23 -08:00
parent 253cb8c2b5
commit 99d95d8168
6 changed files with 136 additions and 6 deletions

View File

@@ -9,14 +9,14 @@
package com.facebook.react.flat;
import java.util.ArrayList;
import javax.annotation.Nullable;
import java.util.ArrayList;
import com.facebook.csslayout.CSSNode;
import com.facebook.csslayout.Spacing;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.OnLayoutEvent;
import com.facebook.react.uimanager.ReactStylesDiffMap;
import com.facebook.react.uimanager.events.EventDispatcher;
/**
@@ -240,7 +240,11 @@ import com.facebook.react.uimanager.events.EventDispatcher;
isAndroidView,
needsCustomLayoutForChildren);
if (node.isVirtualAnchor()) {
// this is a temporary measure to skip adding node regions for RCTTextInput. This will be fixed
// in a patch soon which will convert AndroidView into an interface, thus allowing RCTTextInput
// to be treated as an AndroidView
boolean skipAddingNodeRegion = node instanceof RCTTextInput;
if (!isAndroidView && node.isVirtualAnchor() && !skipAddingNodeRegion) {
// If RCTText is mounted to View, virtual children will not receive any touch events
// because they don't get added to nodeRegions, so nodeRegions will be empty and
// FlatViewGroup.reactTagForTouch() will always return RCTText's id. To fix the issue,
@@ -276,6 +280,11 @@ import com.facebook.react.uimanager.events.EventDispatcher;
nodeRegions);
}
if (node.hasUpdates()) {
node.onCollectExtraUpdates(mOperationsQueue);
node.markUpdateSeen();
}
final FlatShadowNode[] nativeChildren = mNativeChildren.finish();
if (nativeChildren != null) {
updateNativeChildren(node, tag, node.getNativeChildren(), nativeChildren);