@Override protected @Nullable TreeProps getTreeProps() { return super.getTreeProps(); } }
Component.isNestedTree((Component) this) && !resolveNestedTree; final TreeProps parentTreeProps = context.getTreeProps(); context.setTreeProps(getTreePropsForChildren(context, parentTreeProps)); if (deferNestedTreeResolution) { node = ComponentsPools.acquireInternalNode(context); node.markIsNestedTreeHolder(context.getTreeProps()); } else if (component.canResolve()) { context.setTreeProps(component.getScopedContext().getTreePropsCopy());
@Nullable final TreeProps treeProps = scopedContext.getTreeProps(); if (treeProps == null) { return null;
@Nullable final TreeProps treeProps = c.getTreeProps(); if (treeProps == null) { return perfEvent;
/** * Prepares a component for calling any pending state updates on it by setting the TreeProps which * the component requires from its parent, setting a scoped component context and applies the * pending state updates. * * @param c component context */ private void applyStateUpdates(ComponentContext c) { setScopedContext(ComponentContext.withComponentScope(c, this)); populateTreeProps(getScopedContext().getTreeProps()); if (hasState()) { c.getStateHandler().applyStateUpdatesForComponent(this); } }
@Test public void testSetRootWithTreePropsThenMeasure() { ComponentTree componentTree = create(mContext, mComponent).build(); componentTree.setLithoView(new LithoView(mContext)); componentTree.attach(); final TreeProps treeProps = new TreeProps(); treeProps.put(Object.class, "hello world"); componentTree.setRootAndSizeSpecAsync( TestDrawableComponent.create(mContext).build(), makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY), treeProps); assertThat(componentTree.getBackgroundLayoutState()).isNull(); componentTree.measure(makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY), new int[2], true); final ComponentContext c = getInternalState(componentTree.getMainThreadLayoutState(), "mContext"); assertThat(c.getTreeProps()).isNotNull(); assertThat(c.getTreeProps().get(Object.class)).isEqualTo(treeProps.get(Object.class)); }
@Test public void testSetRootAndSizeSpecWithTreeProps() { ComponentTree componentTree = create(mContext, mComponent).build(); final Size size = new Size(); final TreeProps treeProps = new TreeProps(); treeProps.put(Object.class, "hello world"); componentTree.setRootAndSizeSpec( TestDrawableComponent.create(mContext).build(), makeSizeSpec(100, EXACTLY), makeSizeSpec(100, EXACTLY), size, treeProps); final ComponentContext c = getInternalState(componentTree.getBackgroundLayoutState(), "mContext"); assertThat(c.getTreeProps()).isSameAs(treeProps); }