| 1487 | if (_scrollState == nullptr || !_scrollState->isInScrollMode()) { |
| 1488 | return 0; |
| 1489 | } |
| 1490 | return _scrollState->getRtlOffsetX(); |
| 1491 | } |
| 1492 | |
| 1493 | float ViewNode::getViewOffsetX() const { |
| 1494 | return _viewFrame.x - _calculatedFrame.x; |
| 1495 | } |
| 1496 | |
| 1497 | float ViewNode::getViewOffsetY() const { |
| 1498 | return _viewFrame.y - _calculatedFrame.y; |
| 1499 | } |
| 1500 | |
| 1501 | const StringBox& ViewNode::getViewClassName() const { |
| 1502 | const auto& boundAttributes = _attributesApplier.getBoundAttributes(); |
| 1503 | if (boundAttributes == nullptr) { |
| 1504 | return StringBox::emptyString(); |
| 1505 | } |
| 1506 | |
| 1507 | return boundAttributes->getClassName(); |
| 1508 | } |
| 1509 | |
| 1510 | void ViewNode::setViewFactory(ViewTransactionScope& viewTransactionScope, const Ref<ViewFactory>& viewFactory) { |
| 1511 | if (_viewFactory != viewFactory) { |
| 1512 | removeView(viewTransactionScope); |
| 1513 | _viewFactory = viewFactory; |
| 1514 | auto previousManagesChildFrames = managesChildFrames(); |
| 1515 | _flags[kManagesChildFrames] = viewFactory != nullptr && viewFactory->managesChildFrames(); |
| 1516 | if (previousManagesChildFrames != managesChildFrames()) { |
| 1517 | auto previousIsLazyLayout = isLazyLayout(); |
| 1518 | updateIsLazyLayout(viewTransactionScope); |
| 1519 | if (previousIsLazyLayout == isLazyLayout()) { |
| 1520 | reinsertChildrenInYogaContainer(viewTransactionScope); |
| 1521 | } |
| 1522 | } |
| 1523 | |
| 1524 | if (viewFactory != nullptr) { |
| 1525 | setIsLayout(viewFactory->getViewClassName() == AttributesManager::getLayoutPlaceholderClassName()); |
| 1526 | auto boundAttributes = viewFactory->getBoundAttributes(); |
| 1527 | _attributesApplier.setBoundAttributes(boundAttributes); |
| 1528 | _flags[kScrollAttributesBound] = |
| 1529 | (boundAttributes != nullptr && boundAttributes->isBackingClassScrollable()); |
| 1530 | |
| 1531 | if (_flags[kScrollAttributesBound]) { |
| 1532 | getYogaStyle(getYogaNodeForInsertingChildren()).setOverflow(facebook::yoga::Overflow::Scroll); |
| 1533 | } |
| 1534 | updateYogaMeasureFunc(); |
| 1535 | } else { |
| 1536 | setIsLayout(true); |
| 1537 | _attributesApplier.setBoundAttributes(nullptr); |
| 1538 | } |
| 1539 | } |