Make AndroidView an interface

Summary:
The current AndroidView stipulates that the backing shadow node can't
be a FlatShadowNode. In some cases, however, we want to apply some of the same
logic (ex not adding NodeRegions, etc) to other ViewManagers that have a
FlatShadowNode backing (and that don't necessarily create a FlatViewGroup).
This commit renames AndroidView to NativeViewWrapper, and re-introduces
AndroidView as an interface, so that logic for padding, NodeRegions, etc can
be shared.

Differential Revision: D2942387
This commit is contained in:
Ahmed El-Helw
2016-02-17 19:08:19 -08:00
parent b461c70b76
commit f0535152ab
5 changed files with 142 additions and 106 deletions

View File

@@ -240,11 +240,7 @@ import com.facebook.react.uimanager.events.EventDispatcher;
isAndroidView,
needsCustomLayoutForChildren);
// 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 (!isAndroidView && node.isVirtualAnchor()) {
// 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,