Skip to content

Commit ffd1f88

Browse files
dev-yongbuzz.lee
andauthored
Fix infinite scroll issue with a single view controller (#245)
If viewController is only one and infinite, there was a situation that the view was not visible. Co-authored-by: buzz.lee <[email protected]>
1 parent c0b276d commit ffd1f88

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Sources/Pageboy/PageboyViewController+Management.swift

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,7 @@ extension PageboyViewController: UIPageViewControllerDataSource {
254254
return nil
255255
}
256256

257-
if let index = currentIndex {
257+
if let index = currentIndex, viewControllerCount > 1 {
258258
if index != 0 {
259259
return fetchViewController(at: index - 1)
260260
} else if isInfiniteScrollEnabled {
@@ -270,7 +270,7 @@ extension PageboyViewController: UIPageViewControllerDataSource {
270270
return nil
271271
}
272272

273-
if let index = currentIndex {
273+
if let index = currentIndex, viewControllerCount > 1 {
274274
if index != viewControllerCount - 1 {
275275
return fetchViewController(at: index + 1)
276276
} else if isInfiniteScrollEnabled {

0 commit comments

Comments
 (0)