antoniocasero / Panels

Panels is a framework to easily add sliding panels to your application
MIT License
1.5k stars 89 forks source link

HeaderHeight calculation pushes Header further down with each show #7

Closed caffeineflo closed 5 years ago

caffeineflo commented 5 years ago

The premise is relatively simple, looking at https://github.com/antoniocasero/Panels/blob/master/Sources/Panels.swift#L50 the safeAreaBottom is added to the PanelHeightConstraint every time show is being executed.

Now in my specific use case, I instantiate the Panelable VC with my parent VC and only show the Panel on didSelect, I dismiss it on didDeselect. With this behavior, the headerHeigh grows every time I execute show which ends up pushing my header further down each time. The examples show the same behavior (although, it's constraints break and recovery recovers the correct constraints).

antoniocasero commented 5 years ago

Yes, this is a use case that I didn't contemplate. It happens when the panel is reused to be shown/dismissed. I have a solution in mind, I will push a fix this weekend. Thanks for reporting 👍

antoniocasero commented 5 years ago

Please @caffeineflo, reopen if you still have problems

caffeineflo commented 5 years ago

I'll try it tomorrow morning and report back. Thanks for the quick turnaround!

caffeineflo commented 5 years ago

@antoniocasero I might be missing some configuration to make this work. But when I click the panel now, it won't scroll up... I'll add a gif to it that makes it more clear

antoniocasero commented 5 years ago

Some example code would be perfect

Sent from my iPhone

On 29. Oct 2018, at 22:19, Florian Harr notifications@github.com wrote:

@antoniocasero I might be missing some configuration to make this work. But when I click the panel now, it won't scroll up... I'll add a gif to it that makes it more clear

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or mute the thread.

caffeineflo commented 5 years ago

I instantiate the panel with the VC, so e.g. let panel = UIStoryboard(name: "Main", bundle: nil).instantiateViewController(withIdentifier: "Panel") as! PanelClass (PanelClass conforms to Panelable). Now on didSelect I show the panel and on didDescelect I dismiss the panel. See gif for the behavior this ends up giving me panels

antoniocasero commented 5 years ago

Sorry I can not reproduce this issue. Maybe some missing values in the PanelConfiguration? Could you check what is the value in the method -movePanel(_:) when you tap on the panel?