rechsteiner / Parchment

A paging view with a highly customizable menu ✨
MIT License
3.39k stars 419 forks source link

PageView does not work in ScrollView #647

Closed canozt closed 1 year ago

canozt commented 2 years ago

I am using version 3.1.0. In swiftui, Pageview does not work when you put it in ScrollView. Probably it is related to nested scrollviews issue. It works when you set frame but the content of the pageview will be dynamic. Is there any trick to solve that issue ?

ScrollView {
      PageView(options: getOptions(), items: items, selectedIndex: $selectedIndex) { item in
           VStack {
                   ForEach(0..<100) { i in
                        Text("\(i)")
                   }
               }
            }
}
lasodashutosh commented 2 years ago

@canozt were you able to find the solution to this?

canozt commented 2 years ago

@lasodashutosh Not really. Firstly i tried to calculate the height of the inner scroll and set the frame height with that value. It works but then i did not like that solution. Then i remove the upper ScrollView, and put it into PageView.