Skip to content

Commit

Permalink
feat(slides): expose updateAutoHeight (#17208)
Browse files Browse the repository at this point in the history
fixes #15079
  • Loading branch information
manucorporat authored Jan 22, 2019
1 parent a945b03 commit 835aea9
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 2 deletions.
2 changes: 1 addition & 1 deletion angular/src/directives/proxies.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,7 +794,7 @@ export class IonSlides {
proxyOutputs(this, this.el, ['ionSlidesDidLoad', 'ionSlideTap', 'ionSlideDoubleTap', 'ionSlideWillChange', 'ionSlideDidChange', 'ionSlideNextStart', 'ionSlidePrevStart', 'ionSlideNextEnd', 'ionSlidePrevEnd', 'ionSlideTransitionStart', 'ionSlideTransitionEnd', 'ionSlideDrag', 'ionSlideReachStart', 'ionSlideReachEnd', 'ionSlideTouchStart', 'ionSlideTouchEnd']);
}
}
proxyMethods(IonSlides, ['update', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes']);
proxyMethods(IonSlides, ['update', 'updateAutoHeight', 'slideTo', 'slideNext', 'slidePrev', 'getActiveIndex', 'getPreviousIndex', 'length', 'isEnd', 'isBeginning', 'startAutoplay', 'stopAutoplay', 'lockSwipeToNext', 'lockSwipeToPrev', 'lockSwipes']);
proxyInputs(IonSlides, ['mode', 'options', 'pager', 'scrollbar']);

export declare interface IonSpinner extends StencilComponents<'IonSpinner'> {}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class NavigationPage3Component {
private navController: NavController
) {}

ionViewDidEnter() {
ionViewDidEnter() {
this.navController.navigateRoot('/navigation/page2');
}
}
1 change: 1 addition & 0 deletions core/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -999,6 +999,7 @@ ion-slides,method,slideTo,slideTo(index: number, speed?: number | undefined, run
ion-slides,method,startAutoplay,startAutoplay() => Promise<void>
ion-slides,method,stopAutoplay,stopAutoplay() => Promise<void>
ion-slides,method,update,update() => Promise<void>
ion-slides,method,updateAutoHeight,updateAutoHeight(speed?: number | undefined) => Promise<void>
ion-slides,event,ionSlideDidChange,void,true
ion-slides,event,ionSlideDoubleTap,void,true
ion-slides,event,ionSlideDrag,void,true
Expand Down
4 changes: 4 additions & 0 deletions core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4189,6 +4189,10 @@ export namespace Components {
* Update the underlying slider implementation. Call this if you've added or removed child slides.
*/
'update': () => Promise<void>;
/**
* Force swiper to update its height (when autoHeight enabled) for the duration equal to 'speed' parameter
*/
'updateAutoHeight': (speed?: number | undefined) => Promise<void>;
}
interface IonSlidesAttributes extends StencilHTMLAttributes {
/**
Expand Down
16 changes: 16 additions & 0 deletions core/src/components/slides/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,22 @@ Type: `Promise<void>`



### `updateAutoHeight(speed?: number | undefined) => Promise<void>`

Force swiper to update its height (when autoHeight enabled) for the duration equal to 'speed' parameter

#### Parameters

| Name | Type | Description |
| ------- | --------------------- | ----------- |
| `speed` | `number \| undefined` | |

#### Returns

Type: `Promise<void>`




## CSS Custom Properties

Expand Down
9 changes: 9 additions & 0 deletions core/src/components/slides/slides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,15 @@ export class Slides implements ComponentInterface {
swiper.update();
}

/**
* Force swiper to update its height (when autoHeight enabled) for the duration equal to 'speed' parameter
*/
@Method()
async updateAutoHeight(speed?: number) {
const swiper = await this.getSwiper();
swiper.updateAutoHeight(speed);
}

/**
* Transition to the specified slide.
*/
Expand Down

0 comments on commit 835aea9

Please sign in to comment.