Skip to content

Support sizing of UIKit interop views using Auto Layout#2797

Open
svastven wants to merge 11 commits intojb-mainfrom
svastven/sizing-interop-views-in-compose
Open

Support sizing of UIKit interop views using Auto Layout#2797
svastven wants to merge 11 commits intojb-mainfrom
svastven/sizing-interop-views-in-compose

Conversation

@svastven
Copy link

@svastven svastven commented Feb 26, 2026

Adds support for sizing of UIKit interop views using Auto Layout.

Introduces

  • UIKitInteropElementLayout
    • handles embedding of UIKit containers and userComponent view into hierarchy
  • UIKitInteropElementMeasurer
    • provides MeasurePolicy for the Compose node hosting the UIKit interop view
    • handles calculation of the UIKit userComponent fitting size and providing it to Compose layout
    • handles re-measure requests from UIKitInteropRemeasureRequester
  • UIKitInteropRemeasureRequester
    • can be provided to UIKitInteropProperties
    • provides a way to request remeasurement of UIKitView or UIKitViewController based on fitting size changes of the given interopView

Fixes CMP-9123 iOS support intrinsic sizing of interop elements - UIView with NSLayoutConstraints

Testing

Adds iOS instrumented tests covering interop view behavior:

  • wrap-content sizing from UIKit fixed constraints
  • Compose fixed size modifiers (size, fillMaxSize) vs UIKit constraints
  • multiline UILabel fitting in combinations (fixed width / fixed height / no explicit size)
  • UIStackView fitting
  • aspect-ratio constraint fitting
  • explicit remeasure flow using UIKitInteropRemeasureRequester (constraint constant change, text change)
  • remeasureRequester lifecycle (binding/unbinding when interop node is added/removed)

This should be tested by QA

Release Notes

Features - iOS

  • Support sizing of UIKit interop views which are using Auto Layout
  • Add remeasureRequester API to UIKitInteropProperties. Use UIKitInteropRemeasureRequester.requestRemeasure() to request re-measurement of UIKitView or UIKitViewController
  • Add rememberUIKitInteropRemeasureRequester() API

@svastven svastven requested review from ASalavei, MatkovIvan and mazunin-v-jb and removed request for MatkovIvan February 26, 2026 11:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant