OnCreateMountContent

The method annotated with this annotation will be called to instantiate the mount content for the MountSpec, when the pool of objects corresponding to this mount content type is empty and recycling is not possible. The mount content can be either a View or a Drawable.

You can think of methods annotated with OnCreateMountContent as the equivalent of the RecyclerView.Adapter's createViewHolder method. If the pool for this mount content is not empty and the framework can recycle mount content objects, this method will not be invoked.

The annotated method will return the created mount content, either a View or a Drawable type, and receives the following arguments from the framework:

Required:

  1. ComponentContext
No other arguments, such as Prop, State or any inter-stage props are allowed in this method.

The OnCreateMountContent method cannot provide inter-stage props.

See also

Functions

Link copied to clipboard
abstract fun annotationType(): Class<out Annotation>
Link copied to clipboard
abstract fun equals(p: Any): Boolean
Link copied to clipboard
abstract fun hashCode(): Int
Link copied to clipboard
abstract fun mountingType(): MountingType
The type of class used for the mount content.
Link copied to clipboard
abstract fun toString(): String