Fabric: Stopping creating ShadowView instances for non-View ShadowNodes
Summary: Apparently, the previous behavior brings more problems than some *possible-in-the-future* features and flexibility. The new model allows us to easily implement "nested text" feature. (We temporary hope the old behavious for Android only for compatibility reasons.) Reviewed By: mdvacca Differential Revision: D13176277 fbshipit-source-id: 01f7bfb3c2e70cc89d76ecb78add016ee91cbd63
This commit is contained in:
parent
e581977b51
commit
cd5f0bd95c
|
@ -28,6 +28,10 @@ public:
|
|||
}
|
||||
|
||||
void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, ComponentName componentName, bool isLayoutable, ComponentHandle componentHandle) override {
|
||||
if (!isLayoutable) {
|
||||
return;
|
||||
}
|
||||
|
||||
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
|
||||
[scheduler.delegate schedulerOptimisticallyCreateComponentViewWithComponentHandle:componentHandle];
|
||||
}
|
||||
|
|
|
@ -20,7 +20,17 @@ static void sliceChildShadowNodeViewPairsRecursively(
|
|||
|
||||
const auto layoutableShadowNode =
|
||||
dynamic_cast<const LayoutableShadowNode *>(childShadowNode.get());
|
||||
#ifndef ANDROID
|
||||
// New approach (iOS):
|
||||
// Non-view components are treated as layout-only views (they aren't
|
||||
// represented as `ShadowView`s).
|
||||
if (!layoutableShadowNode || layoutableShadowNode->isLayoutOnly()) {
|
||||
#else
|
||||
// Previous approach (Android):
|
||||
// Non-view components are treated as normal views with an empty layout
|
||||
// (they are represented as `ShadowView`s).
|
||||
if (layoutableShadowNode && layoutableShadowNode->isLayoutOnly()) {
|
||||
#endif
|
||||
sliceChildShadowNodeViewPairsRecursively(
|
||||
pairList,
|
||||
layoutOffset + shadowView.layoutMetrics.frame.origin,
|
||||
|
|
Loading…
Reference in New Issue