HPParallaxHeader icon indicating copy to clipboard operation
HPParallaxHeader copied to clipboard

[BUG] delegate parallaxHeaderDidScroll is called before scrolling

Open sugitatestblue opened this issue 2 years ago • 6 comments

parallaxHeaderDidScroll method return strange values even before my scrolling.(when initialized?)

func parallaxHeaderDidScroll(_ parallaxHeader: HPParallaxHeader) {
    var progress = parallaxHeader.progress
    print(progress)
}

In the first loaded view controller.

it logged 1, 0 before scrolling.

sugitatestblue avatar May 26 '22 06:05 sugitatestblue

Hi, at the first time loading the parallax header is expand so progress = 1 is correct. Moreover, at the first time loading the scrollview has to layout its content and change it content offset to expand the parallax header so the callback has to be triggered. So this should not be considered as bug.

ngochiencse avatar Jun 02 '22 02:06 ngochiencse

1 is correct but, 0 also returned after 1 automatically.

[1.0]
[0.0]   

SPEC: 15.3.1, iPhone 12

sugitatestblue avatar Jun 02 '22 03:06 sugitatestblue

I can't reproduce the bug. Could you send me sample project?

ngochiencse avatar Jun 02 '22 03:06 ngochiencse

It is first time. after build.

Strangely, other spec iPhone returns 1 only. But it returns more than 1 in the first time.

SPEC: 14.8 iPhone, 14.8

sugitatestblue avatar Jun 02 '22 03:06 sugitatestblue

Could you send me sample project?

unfortunately it is big project.

sugitatestblue avatar Jun 02 '22 03:06 sugitatestblue

But it returns more than 1 in the first time. => this is because when we set parallax header's height and minimumHeight the contentOffset of the scrollview is not updated yet causing the progress to be > 1 at first time loading. So this will not be considered as bug.

1 is correct but, 0 also returned after 1 automatically.

[1.0]
[0.0]   

SPEC: 15.3.1, iPhone 12

=> about this I still haven't been able to reproduced it yet. Could you make a minimal sample apart from your project so I can take a look?

ngochiencse avatar Jun 02 '22 06:06 ngochiencse