fix(datetime): haptics are enabled only on ios (#26370)

resolves #25508

BREAKING CHANGE:

The haptics when swiping the wheel picker are now enabled only on iOS.
This commit is contained in:
Liam DeBeasi
2022-11-29 14:23:25 -05:00
committed by GitHub
parent c74901c973
commit 8eec1974da
2 changed files with 12 additions and 3 deletions

View File

@ -1,5 +1,6 @@
import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Method, Prop, State, Watch, h } from '@stencil/core';
import { isPlatform } from '@utils/platform';
import { getIonMode } from '../../global/ionic-global';
import type { Color } from '../../interface';
@ -229,6 +230,12 @@ export class PickerColumnInternal implements ComponentInterface {
* the item object.
*/
private initializeScrollListener = () => {
/**
* The haptics for the wheel picker are
* an iOS-only feature. As a result, they should
* be disabled on Android.
*/
const enableHaptics = isPlatform('ios');
const { el } = this;
let timeout: any;
@ -242,7 +249,7 @@ export class PickerColumnInternal implements ComponentInterface {
}
if (!this.isScrolling) {
hapticSelectionStart();
enableHaptics && hapticSelectionStart();
this.isScrolling = true;
}
@ -268,7 +275,7 @@ export class PickerColumnInternal implements ComponentInterface {
* we need to run haptics again.
*/
if (activeElement !== activeEl) {
hapticSelectionChanged();
enableHaptics && hapticSelectionChanged();
}
activeEl = activeElement;
@ -276,7 +283,7 @@ export class PickerColumnInternal implements ComponentInterface {
timeout = setTimeout(() => {
this.isScrolling = false;
hapticSelectionEnd();
enableHaptics && hapticSelectionEnd();
/**
* Certain tasks (such as those that