compose-views-interop

Configure ComposeView and AndroidView interop boundaries to prevent performance regressions and lifecycle bugs.

1|1|Updated May 23, 2026
One-click install
npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-views-interop
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: compose-views-interop
Source: https://github.com/santimattius/performance-compose-skills/tree/main/skills/compose-views-interop
Command: npx skills add https://github.com/santimattius/performance-compose-skills --skill compose-views-interop

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill helps you prevent jank, leaks, and wasted recomposition work when migrating Android apps that must run both classic Views and Jetpack Compose together.

Core Features & Use Cases

  • Choose the right interop boundary for hosting Compose inside Views (ComposeView) or hosting Views inside Compose (AndroidView), including RecyclerView/ViewPager2 hybrids and Fragment/Dialog hosting.
  • Apply performance-first phase thinking so state reads at the interop boundary don’t accidentally trigger high-cost Composition work every frame.
  • Select the correct ViewCompositionStrategy to ensure Compose is disposed at the right lifecycle moment (especially in Fragments and RecyclerView ViewHolders).

Quick Start

Load compose-views-interop, then apply the interop decision tree to your ComposeView/AndroidView setup and adjust update/setContent patterns and ViewCompositionStrategy to eliminate hybrid performance regressions.

Frequently Asked Questions about compose-views-interop

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I fix jank when using ComposeView in RecyclerView ViewHolders?

To fix jank in ComposeView RecyclerView ViewHolders, minimize Composition-phase work at interop boundaries by using lean update blocks and implementing proper release/reset handling for reused hybrid containers.

What is ViewCompositionStrategy used for during Compose migration?

ViewCompositionStrategy ensures Compose disposes at the correct lifecycle moment when hosting ComposeView in Fragments or RecyclerView ViewHolders, preventing memory leaks and lifecycle bugs during incremental View to Compose migration.

How do I prevent recomposition loops when embedding Android Views in Compose?

Prevent recomposition loops when embedding Android Views in Compose by minimizing Composition-phase work at the interop boundary, using lean update blocks in AndroidView, and avoiding accidental high-cost state reads every frame.

Does ComposeView work with ViewPager2 pages without leaking memory?

ComposeView works with ViewPager2 pages without leaking memory when you select the correct ViewCompositionStrategy for disposal and apply performance-first phase thinking to state reads at the interop boundaries.

What is the best way to host SDK-only widgets inside Jetpack Compose?

The best way to host SDK-only widgets inside Jetpack Compose is using AndroidView, ensuring you apply lean update blocks and performance-first phase thinking to prevent wasted recomposition work at the interop boundary.

Why does ComposeView cause lifecycle bugs in Fragments?

ComposeView causes lifecycle bugs in Fragments when the ViewCompositionStrategy is not configured correctly for disposal, leading to Compose attempting to dispose at the wrong lifecycle moment during the incremental migration process.