8

I am implementing a chat in SwiftUI. I am using a double rotated list to show the most recent chat messages on the bottom. Each message has a context menu attached. But there is bug: when tapping on the context menu, the message does an erroneous rotation animation. It looks bad. Using XCode 12.2.

Any ideas how to get this working? I did file a bug report with Apple, but that typically takes months (years?).

Here is basic example:

import SwiftUI

struct FlippedContextMenuBug: View {
    var body: some View {
        ScrollView {
            ForEach(0..<100) { i in
                Text("Message \(i)")
                    .padding()
                    .contextMenu(menuItems: {
                        Text("Menu Item 1")
                    })
                    .rotationEffect(.pi)
            }
        }
        .rotationEffect(.pi)
    }
}

struct FlippedContextMenuBug_Previews: PreviewProvider {
    static var previews: some View {
        FlippedContextMenuBug()
    }
}

Thank you!

Arman
  • 1,208
  • 1
  • 12
  • 17

0 Answers0