JetBrains / compose-multiplatform

Compose Multiplatform, a modern UI framework for Kotlin that makes building performant and beautiful user interfaces easy and enjoyable.
https://jetbrains.com/lp/compose-multiplatform
Apache License 2.0
15.42k stars 1.12k forks source link

Compose 1.6.0 full recomposition after keyboard appearing (iOS) #4434

Open piskunovvitaly opened 4 months ago

piskunovvitaly commented 4 months ago

Describe the bug When we click on any input to bring up the keyboard, we trigger a full recomposition several times starting with the ComposeUIViewController. This bug is specific to iOS and only occurs in Compose version 1.6.0. In previous versions (1.5.x) this problem do not exist.

Affected platforms

Versions

To Reproduce Steps and/or the code snippet to reproduce the behavior:

  1. Open any sample project with TextField
  2. Click on TextField

Expected behavior Lack of full recomposition

babramovitch commented 4 months ago

A workaround if you don't rely on any other iOS animation in the meantime is to disable animations

@main
struct iOSApp: App {

    init() {
        FirebaseApp.configure()
        UIView.setAnimationsEnabled(false)
    }

    var body: some Scene {
        WindowGroup {
            ZStack {
                ContentView()
            }.preferredColorScheme(.dark).ignoresSafeArea(.keyboard)
        }
    }
}
solita-michalguspiel commented 3 months ago

This also causes unnecessary recompositions even after text field interaction. I describe my issue in a bigger detail in kotlin slack

UIView.setAnimationsEnabled(false) fixes it.

okushnikov commented 10 hours ago

Please check the following ticket on YouTrack for follow-ups to this issue. GitHub issues will be closed in the coming weeks.