Skip to content

Issue: .id() change does not trigger view recreation in SkipUI #274

@marcprux

Description

@marcprux

Discussed in https://github.com/orgs/skiptools/discussions/545

Originally posted by ajayjapan December 1, 2025

Expected Behavior (SwiftUI)

In native SwiftUI, changing a view’s .id value forces SwiftUI to treat the view as a new instance.
This causes a full teardown and recreation of the view, resetting any @State within it.

Actual Behavior (SkipUI)

In SkipUI (Android), changing the .id does not cause the view to remount.
Internal state persists and the subtree is not recreated.

Minimal Example

struct ContentView: View {
    @State var toggle = false

    var body: some View {
        VStack {
            CounterView()
                .id(toggle) // should force recreation when toggle changes

            Button("Refresh") {
                toggle.toggle()
            }
        }
    }
}

struct CounterView: View {
    @State var count = 0

    var body: some View {
        VStack {
            Text("Count: \(count)")
            Button("Increment") {
                count += 1
            }
        }
    }
}

If fixing this behavior is possible, that would be ideal. If not, adding a note to the README.md (or SkipUI docs) explaining the limitation would be nice. For now I’m using a small hack (showing a 1-second loading screen) to force a refresh (so its not urgent).

Thanks,

Ajay

Metadata

Metadata

Assignees

Labels

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

Type

No type

Projects

Status

Todo

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions