Skip to content

Commit

Permalink
fix(slides): fix mutable options
Browse files Browse the repository at this point in the history
  • Loading branch information
manucorporat committed Sep 15, 2018
1 parent 7bc9a07 commit 681981f
Show file tree
Hide file tree
Showing 7 changed files with 241 additions and 48 deletions.
2 changes: 1 addition & 1 deletion core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"selenium-webdriver": "^3.6.0",
"stylelint": "^9.4.0",
"stylelint-order": "^0.8.1",
"swiper": "4.3.5",
"swiper": "4.4.1",
"tslint": "^5.10.0",
"tslint-ionic-rules": "0.0.19",
"tslint-react": "^3.6.0",
Expand Down
2 changes: 1 addition & 1 deletion core/src/components.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4223,7 +4223,7 @@ export namespace Components {
/**
* Transition to the next slide.
*/
'slideNext': (speed: number, runCallbacks: boolean) => Promise<void>;
'slideNext': (speed?: number | undefined, runCallbacks?: boolean | undefined) => Promise<void>;
/**
* Transition to the previous slide.
*/
Expand Down
4 changes: 2 additions & 2 deletions core/src/components/datetime/datetime.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ export class Datetime implements ComponentInterface {
}

const pickerOptions = this.generatePickerOptions();
this.picker = await this.pickerCtrl.create(pickerOptions);
const picker = this.picker = await this.pickerCtrl.create(pickerOptions);
await this.validate();
await this.picker.present();
await picker.present();
}

private emitStyle() {
Expand Down
14 changes: 8 additions & 6 deletions core/src/components/slides/slides.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,12 @@ export class Slides implements ComponentInterface {
@Prop() options: any = {}; // SwiperOptions; // TODO

@Watch('options')
async updateSwiperOptions() {
const swiper = await this.getSwiper();
swiper.params = this.normalizeOptions();
await this.update();
async optionsChanged() {
if (this.didInit) {
const swiper = await this.getSwiper();
Object.assign(swiper.params, this.options);
await this.update();
}
}

/**
Expand Down Expand Up @@ -173,9 +175,9 @@ export class Slides implements ComponentInterface {
* Transition to the next slide.
*/
@Method()
async slideNext(speed: number, runCallbacks: boolean) {
async slideNext(speed?: number, runCallbacks?: boolean) {
const swiper = await this.getSwiper();
swiper.slideNext(speed, runCallbacks);
swiper.slideNext(speed!, runCallbacks!);
}

/**
Expand Down
Loading

0 comments on commit 681981f

Please sign in to comment.