arielfaur / ionic-pullup

A pull up footer component for Ionic
http://arielfaur.github.io/ionic-pullup
85 stars 42 forks source link

Dynamic [minBottomVisible] causes "changes.state is undefined" #52

Open SENAHK opened 4 years ago

SENAHK commented 4 years ago

Hi,

I'm trying to make a dynamic pullup that will fit (in collapsed state) the remaining space after an img's src has loaded (it can take at least a few seconds). Currently I'm simply assigning minBottomVisible to a variable that changes when load event of img is fired.

HTML

<ion-content id="content-img">
  <div height="70%" id="imgDiv" #img>
    <img height="100%" [src]="this.imgSrc" (load)="ImgHasLoaded()">
  </div>
</ion-content>
<lib-ionic-pullup (onExpand)="footerExpanded()" (onCollapse)="footerCollapsed()" [(state)]="footerState"
  [toolbarTopMargin]="100" [minBottomVisible]="this.height">
  <ion-toolbar id="toolbar-pullup" (click)="toggleFooter()">
    <div class="handle">
      <div class="bar">
      </div>
    </div>
  </ion-toolbar>
  <ion-content>
  </ion-content>
</lib-ionic-pullup>
height = 150;
footerState: IonPullUpFooterState;
constructor(){
    this.footerState = IonPullUpFooterState.Collapsed;
}
ImgHasLoaded(){
    this.height = window.innerHeight - this.img.nativeElement.clientHeight
}

Unfortunately, it causes an error:

ERROR TypeError: "changes.state is undefined"
@ ngOnChanges ionic-pullup.js:357

Any ideas ?

Version is ionic/angular 5.1.0

arielfaur commented 4 years ago

Hi @SENAHK, thanks for reporting this. To be honest, I haven't tested on Ionic 5 yet. I'm currently a bit overwhelmed but I'll try to look into it in the next week(s). Sorry if you needed quick response times but I'm a one-man show 😆

SENAHK commented 4 years ago

Hey, no worries ! Thanks for your work, this ionic-pullup is very useful I must say !