Skip to content

Introspect fails inside LazyVStack #140

@hugehoge

Description

@hugehoge

Environment

  • Xcode 13.2.1
  • iOS 15.2 simulator
  • Introspect 0.1.4

Reproduction

Code

struct ContentView: View {
  var body: some View {
    ScrollView {
      LazyVStack {
        ForEach(0..<20) { index in
          Color(hue: Double(index * 17 % 100) / 100, saturation: 0.5, brightness: 1.0)
            .frame(height: UIScreen.main.bounds.height / 10)
        }

        TextField("Placholder", text: .constant(""))
          .introspectTextField { view in
            view.layer.backgroundColor = UIColor.red.cgColor
          }
          .padding()

        Toggle("Toggle", isOn: .constant(true))
          .introspectSwitch { view in
            view.thumbTintColor = .red
          }
          .padding()
      }
    }
  }
}

Result

Result If use VStack
Reproduction.mp4
UseVStack.mp4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions