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

Method setView

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

Source from the content-addressed store, hash-verified

258 propagateInheritedColorPalette(viewTransactionScope, colorPalette);
259}
260
261const Ref<ColorPalette>& ViewNode::getResolvedColorPalette() const {
262 return _colorPalette;
263}
264
265const Ref<View>& ViewNode::getView() const {
266 return _view;
267}
268
269Ref<View> ViewNode::getViewAndDisablePooling() const {
270 if (_view != nullptr) {
271 _view->setCanBeReused(false);
272 }
273
274 return _view;
275}
276
277Value ViewNode::toPlaformRepresentation(bool wrapInPlatformReference) {
278 return _viewNodeTree->getViewManagerContext()->getViewManager().createViewNodeWrapper(strongSmallRef(this),
279 wrapInPlatformReference);
280}
281
282void ViewNode::setStoredObject(const StringBox& key, const Value& value) {
283 if (value.isNullOrUndefined()) {
284 if (_storedObjects != nullptr) {
285 _storedObjects->erase(key);
286 }
287 return;
288 }
289
290 if (_storedObjects == nullptr) {
291 _storedObjects = makeShared<ValueMap>();
292 }
293 (*_storedObjects)[key] = value;
294}
295
296Value ViewNode::getStoredObject(const StringBox& key) const {
297 if (_storedObjects == nullptr) {
298 return Value::undefined();
299 }
300
301 auto it = _storedObjects->find(key);
302 if (it == _storedObjects->end()) {
303 return Value::undefined();
304 }
305
306 return it->second;
307}

Callers 2

setViewToRootViewNodeMethod · 0.80

Calls 9

callViewCallbackIfNeededFunction · 0.85
strongSmallRefFunction · 0.85
canBeReusedMethod · 0.80
willRemoveViewMethod · 0.80
setNeedsSyncWithViewMethod · 0.80
didAddViewMethod · 0.80
isEmptyMethod · 0.45
willEnqueueViewToPoolMethod · 0.45
enqueueViewToPoolMethod · 0.45

Tested by

no test coverage detected