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

Incorrect behaviour when calling insertPage at currentIndex #211

Closed
crehbichler opened this issue Apr 8, 2019 · 6 comments · Fixed by #243
Closed

Incorrect behaviour when calling insertPage at currentIndex #211

crehbichler opened this issue Apr 8, 2019 · 6 comments · Fixed by #243
Assignees
Labels

Comments

@crehbichler
Copy link

Hi,

so, let's say we have a PageboyViewController that is set up with 1 page.
Then I am updating my input for the PageboyViewControllerDataSource and calling insertPage(at: 0, then: .doNothing).

What I would expect is that the new page will be inserted right before my current ViewController but I'm staying at the current ViewController, because I've specified .doNothing as PageUpdateBehavior.

What happens is that the new page is indeed inserted before my current ViewController, but also it "cross-dissolves" to the inserted ViewController.

I see that this is implemented in the func performUpdates when it's checked if newIndex == currentIndex and then the crossDissolve + updateViewControllers is done. I guess that totally makes sense for deleting the page at the currentIndex, but I'm not sure if this is the desired behaviour for inserting?

Thanks in advance!
(And thanks for building/improving this great library 👍 )


Version

Pageboy (3.2.0)
(actually used with Tabman (2.3.0) but this should be just related to Pageboy)

@msaps
Copy link
Member

msaps commented Apr 21, 2019

@crehbichler 👍 sounds like something we should fix

@msaps msaps added the bug label Apr 21, 2019
@zyflovelam
Copy link

I met this problem too, It seems that it has not been resolved yet?
version: 3.2
Swift: 4.2

@msaps msaps self-assigned this Aug 3, 2019
@jhmacdon
Copy link

@msaps Is there any plan to fix this? Causes issues in one of my projects 😢

@msaps
Copy link
Member

msaps commented Mar 15, 2020

@jhmacdon sorry been really busy of late - will try and get time to work on it this week 👍

@kristiyandobrev
Copy link

@msaps

For now I am using the following workaround.

var dataSource = []
//......
let index = 0
dataSource.insert(viewController, at: index)
pageViewController.reloadData()
pageViewController.scrollToPage(.at(index: index+1), animated: false)

If adding something to the beginning of the data source, I am calling reloadData() which will reload the data source and then scrolling back to the current page without animation.

@msaps
Copy link
Member

msaps commented May 4, 2020

@kristiyandobrev @jhmacdon @zyflovelam @crehbichler this is now resolved as of v3.6.0 🎉

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

Successfully merging a pull request may close this issue.

5 participants