mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-20 07:44:29 +08:00
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:
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user