diff --git a/React/Fabric/RCTScheduler.mm b/React/Fabric/RCTScheduler.mm index 8276a68c9..1b6c8b797 100644 --- a/React/Fabric/RCTScheduler.mm +++ b/React/Fabric/RCTScheduler.mm @@ -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]; } diff --git a/ReactCommon/fabric/uimanager/Differentiator.cpp b/ReactCommon/fabric/uimanager/Differentiator.cpp index 3b6f1f891..9bac22008 100644 --- a/ReactCommon/fabric/uimanager/Differentiator.cpp +++ b/ReactCommon/fabric/uimanager/Differentiator.cpp @@ -20,7 +20,17 @@ static void sliceChildShadowNodeViewPairsRecursively( const auto layoutableShadowNode = dynamic_cast(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,