fermoya / SwiftUIPager

Native Pager in SwiftUI
MIT License
1.27k stars 166 forks source link

[BUG] List inside Pager #288

Open smotched opened 2 years ago

smotched commented 2 years ago

Describe the bug Lists inside the Pager can't be dragged, or two finger swiped on mac

To Reproduce Place a List inside a Pager

    Pager(page: page,
          data: items,
          id: \.self) { item in
      List {
        Text("List\(item)")
        Text("List\(item)")
      }
    }

Expected behavior

Additional context Surprisingly arrow keys work pretty nicely (currently the only way to change pages)

fermoya commented 2 years ago

Hi @smotched , there are two things here:

Btw, the keys do work because those are implemented differently, onMoveCommand if I remember correctly.

smotched commented 2 years ago

Hey @fermoya , I think you meant macOS but yeah even with .pagingPriority(.simultaneous) it unfortunately doesn't work. Could it be a macOS 13 thing maybe? are you getting anything on your side with the basic example above?

sidenote: ScrollView works nicely as well.

fermoya commented 2 years ago

@smotched I see what you mean. Not sure why but in iOS works fine. I'll investigate to solve it.

In any case, it seems to me you're more interested in the trackpad option. It doesn't seem there's SwifUI natively built-in option to listen to this kind of event, all I find follows this approach. I'm not interested in anything that's not native. One option would be to create a view that uses that approach and then moves Pager when desired by using pageOffset modifier

smotched commented 2 years ago

Thanks @fermoya we may have to file a feedback with Apple since like you said it works fine on iOS. I don't see why it shouldn't work if it works with ScrollView unless there's an underlying issue in how List is implemented on mac that's breaking your implementation.

Nevertheless thanks for looking into it!