logisticinfotech / ionic4-datepicker

Ionic 4 Datepicker component
https://www.logisticinfotech.com/blog/ionic4-datepicker-component/
Other
77 stars 33 forks source link

Opens a duplicate modal when using IOS device in chrome dev toolbar #31

Closed Arieru closed 5 years ago

Arieru commented 5 years ago

I use Chrome's device toolbar to simulate mobile views, when I use an Android device (Pixel, Pixel 2) there are no errors, but whenever I use an IOS device (Iphone X, Ipad), it opens the modal twice. (Note: I used the picker as a Directive.)

(I only clicked once.) IOS device view: V628HWBQD7

ANDROID device view: PxM9UWXg7U

SauloLauers1982 commented 5 years ago

can we see ur code? Html and ts?

MikeCraig418 commented 5 years ago

I'm experiencing the same issue.

lukasnys commented 5 years ago

I'm having the same issue.

Both in chrome dev tools as on native.

HTML:

<ion-item>
    <ion-label position="stacked">Start</ion-label>
    <ion-input [liIonic4Datepicker]="startDatePickerObj" readonly formControlName="startDate"></ion-input>
</ion-item>

<ion-item>
    <ion-label position="stacked">End</ion-label>
    <ion-input [liIonic4Datepicker]="endDatePickerObj" readonly formControlName="endDate"></ion-input>
</ion-item

TS: (this code gets executed in ngOnInit)

const datePickerOptions: any = {
            closeOnSelect: true,
            mondayFirst: true,
            clearButton: false,
            yearInAscending: true,
            btnCloseSetInReverse: true,
            btnProperties: {
                expand: "block",
                fill: "",
                size: "",
                disabled: "",
                strong: "",
                color: ""
            }
        };

        // Get translations of the calendar messages for the labels
        this.translate.get("CALENDAR").subscribe(messages => {
            this.startDatePickerObj.todayLabel = messages.Today;
            this.startDatePickerObj.titleLabel = messages.Title;
            this.startDatePickerObj.closeLabel = messages.Close;
            this.startDatePickerObj.monthsList = messages.Months;
            this.startDatePickerObj.weeksList = messages.Days;

            this.endDatePickerObj.todayLabel = messages.Today;
            this.endDatePickerObj.titleLabel = messages.Title;
            this.endDatePickerObj.closeLabel = messages.Close;
            this.endDatePickerObj.monthsList = messages.Months;
            this.endDatePickerObj.weeksList = messages.Days;
        });

        // Make a copy of options so they don't point to same reference
        this.startDatePickerObj = JSON.parse(JSON.stringify(datePickerOptions));
        this.endDatePickerObj = JSON.parse(JSON.stringify(datePickerOptions));

        this.startDatePickerObj.toDate = new Date();
        this.endDatePickerObj.toDate = new Date();
Arieru commented 5 years ago

Install the latest version, that fixed this issue for my case.