Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

moveToPage not working on iOS 14.3 #2

Open
dauerr opened this issue Dec 23, 2020 · 1 comment
Open

moveToPage not working on iOS 14.3 #2

dauerr opened this issue Dec 23, 2020 · 1 comment

Comments

@dauerr
Copy link

dauerr commented Dec 23, 2020

My code:

var pageSize = CGSize(width: 200, height: 300)

    @ObservedObject var psViewModel = PositionScrollViewModel(
            pageSize: CGSize(width: 200, height: 300),
            horizontalScroll: Scroll(
                scrollSetting: ScrollSetting(pageCount: 3, afterMoveType: .fitToNearestUnit),
                pageLength: 200
            )
        )

    var body: some View {
        VStack {
            PositionScrollView(viewModel: self.psViewModel, delegate: self) {
                HStack(spacing: 0) {
                    ForEach(content, id: \.self) { c in
                        Preview(content: c)
                            .frame(width: self.pageSize.width, height: self.pageSize.height)
                        }
                }
            }
            Text("page: \(self.psViewModel.horizontalScroll?.page ?? 0)")
            Text("position: \(self.psViewModel.horizontalScroll?.position ?? 0)")
            HStack {
                roundedButton(text: "Show Previous",
                              onClick: {
                                print("FEATURE NOT IMPLEMENTED")
                              },
                              withArrow: true,
                              arrowRight: false)
                roundedButton(text: "Show Next",
                              onClick: {
                                self.psViewModel.horizontalScroll?.moveToPage(page: self.psViewModel.horizontalScroll!.page + 1)
                              },
                              withArrow: true)
            }
        }
    }

Logs (when 'Show Next' is clicked):

position: 0.0
onChangePage to page: 1

Observed behavior:
Nothing happens

@Junyi1227
Copy link

me too
self.psViewModel.horizontalScroll?.moveToPage not working

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants