Avoid pre-allocating views for non-layoutable shadow nodes
Summary: This diff changes the behavior of the Scheduler.schedulerDidRequestPreliminaryViewAllocation to avoid pre-allocating views that are non-layoutables Reviewed By: shergin Differential Revision: D12962008 fbshipit-source-id: cb2670beafdcbd2116fbdaf2dc5d1b4726330ec2
This commit is contained in:
parent
94d49e544d
commit
33b966139e
|
@ -27,7 +27,7 @@ public:
|
|||
[scheduler.delegate schedulerDidFinishTransaction:mutations rootTag:rootTag];
|
||||
}
|
||||
|
||||
void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, ComponentName componentName) override {
|
||||
void schedulerDidRequestPreliminaryViewAllocation(SurfaceId surfaceId, ComponentName componentName, bool isLayoutable, ComponentHandle componentHandle) override {
|
||||
RCTScheduler *scheduler = (__bridge RCTScheduler *)scheduler_;
|
||||
[scheduler.delegate schedulerDidRequestPreliminaryViewAllocationWithComponentName:RCTNSStringFromString(componentName, NSASCIIStringEncoding)];
|
||||
}
|
||||
|
|
|
@ -185,8 +185,15 @@ void Scheduler::uiManagerDidFinishTransaction(
|
|||
void Scheduler::uiManagerDidCreateShadowNode(
|
||||
const SharedShadowNode &shadowNode) {
|
||||
if (delegate_) {
|
||||
auto layoutableShadowNode =
|
||||
dynamic_cast<const LayoutableShadowNode *>(shadowNode.get());
|
||||
auto isLayoutable = layoutableShadowNode != nullptr;
|
||||
|
||||
delegate_->schedulerDidRequestPreliminaryViewAllocation(
|
||||
shadowNode->getRootTag(), shadowNode->getComponentName());
|
||||
shadowNode->getRootTag(),
|
||||
shadowNode->getComponentName(),
|
||||
isLayoutable,
|
||||
shadowNode->getComponentHandle());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -33,7 +33,9 @@ class SchedulerDelegate {
|
|||
*/
|
||||
virtual void schedulerDidRequestPreliminaryViewAllocation(
|
||||
SurfaceId surfaceId,
|
||||
ComponentName componentName) = 0;
|
||||
ComponentName componentName,
|
||||
bool isLayoutable,
|
||||
ComponentHandle componentHandle) = 0;
|
||||
|
||||
virtual ~SchedulerDelegate() noexcept = default;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue