MCPcopy Create free account
hub / github.com/Snapchat/Valdi / setViewFactory

Method setViewFactory

valdi/src/valdi/runtime/Context/ViewNode.cpp:1394–1414  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1392const StringBox& ViewNode::getViewClassName() const {
1393 const auto& boundAttributes = _attributesApplier.getBoundAttributes();
1394 if (boundAttributes == nullptr) {
1395 return StringBox::emptyString();
1396 }
1397
1398 return boundAttributes->getClassName();
1399}
1400
1401void ViewNode::setViewFactory(ViewTransactionScope& viewTransactionScope, const Ref<ViewFactory>& viewFactory) {
1402 if (_viewFactory != viewFactory) {
1403 removeView(viewTransactionScope);
1404 _viewFactory = viewFactory;
1405
1406 if (viewFactory != nullptr) {
1407 setIsLayout(viewFactory->getViewClassName() == AttributesManager::getLayoutPlaceholderClassName());
1408 auto boundAttributes = viewFactory->getBoundAttributes();
1409 _attributesApplier.setBoundAttributes(boundAttributes);
1410 _flags[kScrollAttributesBound] =
1411 (boundAttributes != nullptr && boundAttributes->isBackingClassScrollable());
1412
1413 if (_flags[kScrollAttributesBound]) {
1414 getYogaStyle(getYogaNodeForInsertingChildren()).setOverflow(facebook::yoga::Overflow::Scroll);
1415 }
1416 } else {
1417 setIsLayout(true);

Callers 5

createNodeMethod · 0.80
setRootViewNodeMethod · 0.80
visitMethod · 0.80
bindMethod · 0.80

Calls 4

setBoundAttributesMethod · 0.80
setOverflowMethod · 0.80
getViewClassNameMethod · 0.45

Tested by 1

createNodeMethod · 0.64