Adding Shadow to ScrollView View results in offset issue

Adding a Shadow to a ScrollView View with a Transition seems to result in an offset issue when using an onTapGesture. The sample code below has a transitioned View with a ScrollView and onTapGesture. Adding a shadow causes an offset, so the onTabGesture picks the wrong image. Once you begin scrolling, the shadowed scrollview works as intended. Removing the Shadow from the ScrollView fixes the offset issue. Leaving the Shadow and removing the Transition also fixes the issue. I can seem to find a solution which would allow both Shadow and Transition?




import SwiftUI

struct ContentView: View {
  
  @State var transition : Bool = false
  @State var backgroundImage : Image
  
  var body: some View {
    VStack {
      Button( action: {withAnimation{self.transition.toggle()}})
        {Text("ScrollView").foregroundColor(.black)}
        .padding(20)
        .background(Color.blue)
        .padding(.bottom, 10)
      Spacer()
      if transition {pictureView1(image: $backgroundImage).transition(.slide)}
      Spacer()
      
    }
      
    .background(backgroundImage)
  }
}

struct ContentView_Previews: PreviewProvider {
  static var previews: some View {
    ContentView(backgroundImage: Image(uiImage: UIImage() ))
  }
}


//with Shadow, tapGesture picks wrong image, when shadow is removed, tapGesture picks correct image
struct pictureView1: View {
  
  var pictures : [String] = ["dog1","dog2","dog3","dog4","dog5"]
  @Binding var image : Image
  
  var body: some View {
    ScrollView(.horizontal) {
      HStack {
        ForEach(pictures, id: \.self) {picture in
          Image(picture).resizable().frame(width: 150, height: 200, alignment: .center)
            .onTapGesture {
              self.image = Image(picture)
          }
        }
        
      }
    }
    .frame(width: 350, height: 220)
    .background(Color.gray)
    .shadow(radius: 5, x: 5, y: 5) //with shadow removed, tapGesture works correctly, no scroll offset issue
  }
}


SceneDelegate:

func scene(_ scene: UIScene, willConnectTo session: UISceneSession, options connectionOptions: UIScene.ConnectionOptions) {
    // Use this method to optionally configure and attach the UIWindow `window` to the provided UIWindowScene `scene`.
    // If using a storyboard, the `window` property will automatically be initialized and attached to the scene.
    // This delegate does not imply the connecting scene or session are new (see `application:configurationForConnectingSceneSession` instead).

    // Create the SwiftUI view that provides the window contents.
    let contentView = ContentView(backgroundImage: Image(uiImage: UIImage()) )