Closed betaengine closed 7 years ago
Hello, thanks for opening an issue with us! Sorry, but i'm not understanding the issue fully. Would you mind creating a repo that i can use to test this issue? Thanks for using Ionic!
@jgw96
-------------------test.html----------------------------
<ion-content>
<div>
<ion-slides [options]="opts">
<ion-slide *ngFor="let test of tests">{{test}}</ion-slide>
</ion-slides>
</div>
</ion-content>
-------------------test.ts----------------------------
@Component({
templateUrl: 'build/pages/test/test.html',
})
export class TestPage implements OnInit{
tests = [1,2,3];
opts: any;
constructor() {}
ngOnInit() {
this.opts = {initialSlide: 1}
}
}
I have set {initialSlide: 1}.The initial index of second pages, but in version beta. 11 can see first display the first page, and then automatically jump to page second.In version beta.10,show second pages at once.
I have that same issue with the { initialSlide = ...}
option. After the page with the slides has loaded, you can see (for a short time) the first of all slides and then the desired 'initialSlide'.
I tried to work around that issue and implemented a slider.slideTo(initialSlide, 0, false)
statement within the various page cycle events (ionViewLoaded
, ionViewWillEnter
, ionViewDidEnter
). Only within the ionViewDidEnter
event the slideTo-statement works as expected and jumps to the 'initialSlide', but with the same tiny lag after showing the first of all slides. So no real workaround.
still flashes first slide in rc0, before showing initialSlide: x
There are few bugs with initialSlide option:
1) Flickering of the view 2) After init with initialSlide option, you can't call getActiveIndex(), error: ORIGINAL EXCEPTION: Cannot read property 'activeIndex' of undefined.
I believe this is caused because the slide is changing to another one and ionDidChange is called
this.horizontalSliderOptions = {
loop: false,
pager: false,
direction: "horizontal",
initialSlide: 1
}
(ionDidChange)="onSlideChanged()"
onSlideChanged(e) {
let activeHorizontal = this.horizontalSlider.getActiveIndex()
}
This bug is still present in Ionic 2 RC2. Maybe you can change the title of the issue?
And also in RC3 :-/
Has anyone tested this issue on RC5 ? I used a workaround on RC4 and it works but I'd rather have a stable solution...
@ericdude4 I'm using RC5 and while there are some slight differences in the implementation of ion-slides in it, it's working as intended. I believe the issue is now solved.
Thanks @AleFons. I am going to close this then, but please let me know if anyone sees the problem with RC6 and I will reopen. :)
Hey @ericdude4 can you post some example?
@miguelmchavez would you like the solution that I found previously? Recently I have updated to Ionic 2 stable release and the issue was resolved, however, I would be more that happy to explain my fix.
yes @ericdude4 , i like the solution that you found previously! Please.
@miguelmchavez This was my solution on RC4, so if you are using an older one, the line where the code is may be different:
1) open node_modules > ionic-angular > components > slide > slide.js
2) locate the following (approx. line 262)
setTimeout(function () {
var swiper = new Swiper(_this.getNativeElement().children[0], options);
_this.slider = swiper;
}, 300);
3) replace this code with:
setTimeout(function () {
var swiper = new Swiper(_this.getNativeElement().children[0], options);
_this.slider = swiper;
});
@ericdude4 Great, can you post your final typescript page?
@miguelmchavez the old typescript page you would have had with the initialSlide issue should work now. It will no longer flash the first slide before moving to the initialSlide.
Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.
open this page,First show the first page, and then jump to the second page But I set second pages for the initial,beta.10 is Available
version: 2.0.0-beta.11