Skip navigation links
com.facebook.litho

Class ComponentTree

    • Method Detail

      • getBackgroundLayoutState

        @Nullable
        protected com.facebook.litho.LayoutState getBackgroundLayoutState()
      • isIncrementalMountEnabled

        public boolean isIncrementalMountEnabled()
        Returns whether incremental mount is enabled or not in this component.
      • setRoot

        public void setRoot(Component rootComponent)
        Update the root component. This can happen in both attached and detached states. In each case we will run a layout and then proxy a message to the main thread to cause a relayout/invalidate.
      • setRootAsync

        public void setRootAsync(Component rootComponent)
      • setSizeSpec

        public void setSizeSpec(int widthSpec,
                                int heightSpec)
        Update the width/height spec. This is useful if you are currently detached and are responding to a configuration change. If you are currently attached then the HostView is the source of truth for width/height, so this call will be ignored.
      • setSizeSpec

        public void setSizeSpec(int widthSpec,
                                int heightSpec,
                                Size output)
        Same as setSizeSpec(int, int) but fetches the resulting width/height in the given Size.
      • setSizeSpecAsync

        public void setSizeSpecAsync(int widthSpec,
                                     int heightSpec)
      • setRootAndSizeSpecAsync

        public void setRootAndSizeSpecAsync(Component root,
                                            int widthSpec,
                                            int heightSpec)
        Compute asynchronously a new layout with the given component root and sizes
      • setRootAndSizeSpec

        public void setRootAndSizeSpec(Component root,
                                       int widthSpec,
                                       int heightSpec)
        Compute a new layout with the given component root and sizes
      • setRootAndSizeSpec

        public void setRootAndSizeSpec(Component root,
                                       int widthSpec,
                                       int heightSpec,
                                       Size output)
      • getStateHandler

        public StateHandler getStateHandler()
        Provides a new instance from the StateHandler pool that is initialized with the information from the StateHandler currently held by the ComponentTree. Once the state updates have been applied and we are back in the main thread the state handler gets released to the pool.
        Returns:
        a copy of the state handler instance held by ComponentTree.
      • consumePreviousRenderState

        public RenderState consumePreviousRenderState()
        Takes ownership of the RenderState object from this ComponentTree - this allows the RenderState to be persisted somewhere and then set back on another ComponentTree using the ComponentTree.Builder. See RenderState for more information on the purpose of this object.
      • release

        public void release()
        The contract is that in order to release a ComponentTree, you must do so from the main thread, or guarantee that it will never be accessed from the main thread again. Usually HostView will handle releasing, but if you never attach to a host view, then you should call release yourself.
      • isReleased

        public boolean isReleased()
      • calculateLayoutState

        protected com.facebook.litho.LayoutState calculateLayoutState(@Nullable
                                                                      Object lock,
                                                                      ComponentContext context,
                                                                      Component root,
                                                                      int widthSpec,
                                                                      int heightSpec,
                                                                      boolean diffingEnabled,
                                                                      @Nullable
                                                                      com.facebook.litho.DiffNode diffNode,
                                                                      int source)
      • generateComponentTreeId

        public static int generateComponentTreeId()