measure
Measure a component with the given SizeSpec constraint.
Delicate API: This API is delicate as it can lead to undefined behaviors when called during resolve. The method should be used strictly during **layout**, otherwise, an IllegalStateException will be thrown when measureInResolvePolicy is set to CRASH
To avoid this issue, use the RenderWithConstraints API for Kotlin Components, which defers component creation until layout phase. As such, it provides SizeConstraints that can be used directly, and if needed, a safe API to measure child components. For
LayoutSpec components that need to measure their children, the @OnCreateLayoutWithSizeSpec annotation should be used instead.
Parameters
Width SizeSpec constraint.
Height SizeSpec constraint.
Size object that will be set with the measured dimensions.
Throws
if called during the resolve phase and measureInResolvePolicy is set to CRASH.
Measure a component with the given SizeSpec constraint.
Delicate API: This API is delicate as it can lead to undefined behaviors when called during resolve. The method should be used strictly during **layout**, otherwise, an IllegalStateException will be thrown when measureInResolvePolicy is set to CRASH
To avoid this issue, use the RenderWithConstraints API for Kotlin Components, which defers component creation until layout phase. As such, it provides SizeConstraints that can be used directly, and if needed, a safe API to measure child components. For
LayoutSpec components that need to measure their children, the @OnCreateLayoutWithSizeSpec annotation should be used instead.
Parameters
Width SizeSpec constraint.
Height SizeSpec constraint.
Size object that will be set with the measured dimensions.
Whether the measurement result should be cached for future use.
Throws
if called during the resolve phase and measureInResolvePolicy is set to CRASH.