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

Method bind

valdi/src/valdi/runtime/Attributes/DefaultAttributes.cpp:24–142  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

22 _scrollAnchorAttributes(Valdi::makeShared<ScrollAnchorAttributes>(attributeIds)),
23 _stickyAttributes(Valdi::makeShared<StickyAttributes>(attributeIds)) {}
24
25void DefaultAttributes::bind(AttributeHandlerById& attributes) {
26 _yogaAttributes->bind(attributes);
27 _accessibilityAttributes->bind(attributes);
28 _scrollAnchorAttributes->bind(attributes);
29 _stickyAttributes->bind(attributes);
30
31 AttributesBinderHelper binder(_attributeIds, attributes);
32
33 binder.bindViewNodeCallback("onViewCreate", &ViewNode::setOnViewCreatedCallback);
34 binder.bindViewNodeCallback("onViewDestroy", &ViewNode::setOnViewDestroyedCallback);
35 binder.bindViewNodeCallback("onViewChange", &ViewNode::setOnViewChangedCallback);
36 binder.bindViewNodeCallback("onLayoutComplete", &ViewNode::setOnLayoutCompletedCallback);
37 binder.bindViewNodeCallback("onMeasure", &ViewNode::setOnMeasureCallback);
38
39 binder.bindViewNodeBoolean("lazyLayout", &ViewNode::setPrefersLazyLayout);
40 binder.bindViewNodeBoolean("animationsEnabled", &ViewNode::setAnimationsEnabled);
41 binder.bindViewNodeBoolean("observeVisibility", &ViewNode::setShouldReceiveVisibilityUpdates);
42 binder.bindViewNodeBoolean("extendViewportWithChildren", &ViewNode::setExtendViewportWithChildren);
43 binder.bindViewNodeBoolean("ignoreParentViewport", &ViewNode::setIgnoreParentViewport);
44 binder.bindViewNodeBoolean("canAlwaysScrollHorizontal", &ViewNode::setCanAlwaysScrollHorizontal);
45 binder.bindViewNodeBoolean("canAlwaysScrollVertical", &ViewNode::setCanAlwaysScrollVertical);
46
47 binder.bindViewNodeFloat("estimatedWidth", &ViewNode::setEstimatedWidth);
48 binder.bindViewNodeFloat("estimatedHeight", &ViewNode::setEstimatedHeight);
49
50 binder.bind(
51 "limitToViewport",
52 [](ViewTransactionScope& /*viewTransactionScope*/, ViewNode& viewNode, const Value& value) -> Result<Void> {
53 if (value.toBool()) {
54 viewNode.setLimitToViewport(LimitToViewportEnabled);
55 } else {
56 viewNode.setLimitToViewport(LimitToViewportDisabled);
57 }
58 return Void();
59 },
60 [](ViewTransactionScope& /*viewTransactionScope*/, auto& viewNode) {
61 viewNode.setLimitToViewport(LimitToViewportUnset);
62 });
63
64 binder.bind(
65 "lazy",
66 [](ViewTransactionScope& viewTransactionScope, auto& viewNode, const auto& value) -> Result<Void> {
67 if (value.toBool()) {
68 viewNode.setPrefersLazyLayout(viewTransactionScope, true);
69 viewNode.setLimitToViewport(LimitToViewportEnabled);
70 } else {
71 viewNode.setPrefersLazyLayout(viewTransactionScope, false);
72 viewNode.setLimitToViewport(LimitToViewportDisabled);
73 }
74 return Void();
75 },
76 [](ViewTransactionScope& viewTransactionScope, auto& viewNode) {
77 viewNode.setPrefersLazyLayout(viewTransactionScope, false);
78 viewNode.setLimitToViewport(LimitToViewportUnset);
79 });
80
81 binder.bindViewNodeInt("zIndex", &ViewNode::setZIndex);

Callers

nothing calls this directly

Calls 15

bindViewNodeCallbackMethod · 0.80
bindViewNodeBooleanMethod · 0.80
bindViewNodeFloatMethod · 0.80
setLimitToViewportMethod · 0.80
setPrefersLazyLayoutMethod · 0.80
bindViewNodeIntMethod · 0.80
getViewNodeTreeMethod · 0.80
setViewFactoryMethod · 0.80
bindMethod · 0.65
VoidClass · 0.50

Tested by

no test coverage detected