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

[BUG] The element inside of Pager is hidden when when it goes beyond the screen border #312

Open
mleykhner opened this issue Feb 20, 2023 · 2 comments
Labels
bug Something isn't working

Comments

@mleykhner
Copy link

Describe the bug
In my code I have HStack with Buttons inside of Pager. Button's label is Text view with RoundedRectangle as it's overlay.

Pager(page: vm.selectedWeekPage, data: vm.deltaWeeksArray, id: \.self) { deltaWeek in
                    HStack{
                        ForEach (vm.fetchWeek(vm.deltaWeek(delta: deltaWeek)), id: \.self){
                            day in
                            Button {
                                vm.selectedDay = day
                            } label: {
                                    Text("\(vm.extractDate(date: day, format: "dd"))")
                                        .font(.custom("Unbounded", size: 20))
                                        .fontWeight(.bold)
                                        .foregroundColor(Color(tm.getTheme().foregroundColor))
                                        .frame(width: 42, height: 42)
                                        .overlay(content: {
                                            RoundedRectangle(cornerRadius: 15, style: .continuous)
                                                .stroke(lineWidth: 2)
                                                .foregroundColor(Color(tm.getTheme().foregroundColor))
                                                .frame(width: 46, height: 46)
                                                .fixedSize()
                                        })
                                    .frame(maxWidth: .infinity)
                            }
                        }
                    }
                    .padding(.horizontal, 18)
                }
                .singlePagination()
                .pagingPriority(.simultaneous)
                .onPageChanged({ page in
                    if page >= vm.deltaWeeksArray.count - 2 {
                        (1..<4).forEach { _ in
                            vm.deltaWeeksArray.append((vm.deltaWeeksArray.last ?? 0) + 1)
                            vm.deltaWeeksArray.removeFirst()
                            vm.selectedWeekPage.index -= 1
                        }
                    } else if page <= 1 {
                        (1..<4).forEach { _ in
                            vm.deltaWeeksArray.insert((vm.deltaWeeksArray.last ?? 0) + 1, at: 0)
                            vm.deltaWeeksArray.removeLast()
                            vm.selectedWeekPage.index += 1
                        }
                    }
                })
                .itemSpacing(50)
                .frame(maxHeight: 48)
                .padding(.horizontal, -18)

Bug happens when I transition to different page. .stroke() hides when Button touches the edge of screen.

Expected behavior
Button expected to be visible until it completely goes beyond the border of the screen.

Screenshots / Videos

2023-02-20.11.30.13.mov

Environment:

  • iOS 16.0
  • iPhone 11 Pro Preview, iPhone 11 Pro
  • 2.5.0
@mleykhner mleykhner added the bug Something isn't working label Feb 20, 2023
@mleykhner mleykhner changed the title [BUG] Shapes hiding when touch edge of screen [BUG] The element inside of Pager is hidden when when it goes beyond the screen border Feb 20, 2023
@THDGunner
Copy link

I also encountered the same problem. Have you solved it?

@THDGunner
Copy link

I fixed it with the .drawingGroup() func.
Pager(xxx) {
}.drawingGroup()

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants