Skip to content

withAnimation() leaks into global state on Android #402

@tifroz

Description

@tifroz

On Android the withAnimation() scope is global: withAnimation() will animate any pending state changes on the visible screen, instead of executing a closure-scoped transition on the subtree.

I put together a repro skip app - The repro app has 2 sibling UI components, the opacity of each is changed from 1 to 0 for both, but only one component should animate the opacity per the withAnimation() closure.

  • Android: both ui components animate
  • iOS: only the closure-targeted component animates (expected behavior)

I am happy to attempts a PR, but it looks like an honest long-term fix will require a serious refactor so I am checking in first in case this needs to be handled by someone who is a lot more familiar with this codebase than I am.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcomposeLimitation of Jetpack Compose or issue with SwiftUI translation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions