You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Thanks for the code!
Which browser/version are you testing this on? This is what I see when I try it out in a blank Ionic starter app (ionic start myApp blank):
Here are the step that I got the issue:
The first time you select the controller it shows correctly.
Then pick an option say "value 3" and click Ok.
Then the second time you show the picker the options don't show correctly if the selectedIndex is set.
The problem with the stacked data still appears in Ionic Angular v5.x.
Even if I use the suggested fixes above, the data appears stacked for around 1 second before arranging correctly.
It looks like the same PickerOptions object must not be reused for several pickers. I. e. if you store options in component instance, do a copy before passing to pickerController.create():
Thanks to @belkka. This is my situation.
Instead of clone opts, I moved columns setup code from ngOnInit() to async openPicker() right above const picker = await this.pickerController.create(), and problem solved.
I got a solution, but I can't reply it on ionicframework.org, then I found similar question here.
Anyway, this is my solution:
If you want to update options, you could make the options same count, such as first time you have 5 items, second time 10 items, you can pad them all to above 10 items, such as 100 items, all the padding items, you can mark them as disable, these disabled items will not be displayed, but the animation seems correct.
// just before => await picker.present();
// use:
for (let col of picker.columns) {
for (let opt of col.options) {
delete opt.selected;
delete opt.duration;
delete opt.transform;
}
}
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.
Activity
liamdebeasi commentedon Mar 4, 2019
Hi there,
Thanks for the issue. Can you share a repository with the code required to reproduce this issue? Thanks!
mariossavva commentedon Mar 5, 2019
Here's a simple example (home.page.ts) from a new blank project. Hope this helps...
liamdebeasi commentedon Mar 5, 2019
Thanks for the code!

Which browser/version are you testing this on? This is what I see when I try it out in a blank Ionic starter app (
ionic start myApp blank):mariossavva commentedon Mar 6, 2019
@liamdebeasi hi. i am using Chrome 72.
Here are the step that I got the issue:
The first time you select the controller it shows correctly.
Then pick an option say "value 3" and click Ok.
Then the second time you show the picker the options don't show correctly if the selectedIndex is set.
I hope this helps
liamdebeasi commentedon Mar 6, 2019
Thanks for the follow up! I can reproduce this issue. We will look into it!
36 remaining items
kheber92 commentedon Feb 25, 2021
The problem with the stacked data still appears in Ionic Angular v5.x.
Even if I use the suggested fixes above, the data appears stacked for around 1 second before arranging correctly.
sergiocarneiro commentedon Mar 20, 2021
2 years and the issue still exists.
Meanwhile I'll use @Galiza's workaround, it works.
alzee commentedon May 1, 2021
Thanks to @belkka. This is my situation.
Instead of clone opts, I moved columns setup code from
ngOnInit()toasync openPicker()right aboveconst picker = await this.pickerController.create(), and problem solved.carlgik4 commentedon Jun 10, 2021
I got a solution, but I can't reply it on ionicframework.org, then I found similar question here.
Anyway, this is my solution:
If you want to update options, you could make the options same count, such as first time you have 5 items, second time 10 items, you can pad them all to above 10 items, such as 100 items, all the padding items, you can mark them as disable, these disabled items will not be displayed, but the animation seems correct.
1st time:
options: [{text, value, disabled: false}..., {text, value, disabled: true}...] // 100items
2nd time:
options: [{text, value, disabled: false}..., {text, value, disabled: true}...] // 100items
It also works with picker.addEventListener('ionPickerColChange', async (event: any) => {}
It seems someone also has the same solution, I wondered why ionic team doesn't fix this issue, it bothers me for several hours.
reza3vi commentedon Sep 18, 2021
yetkin030 commentedon Dec 1, 2021
This problem persists in ionic 5 react version. (useIonPicker)
wall-street-dev commentedon Jan 14, 2022
As a workaround, I'm cleaning the original array of columns' options before showing the picker.
Here's a full example
sean-perkins commentedon Mar 24, 2022
Hello everyone 👋
Can someone please test with this dev build and let me know if you continue to run into any issues?
You should not need any workarounds for deleting values off the object.
ionitron-bot commentedon May 4, 2022
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.