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

@ -104,6 +104,8 @@ This section details the desktop browser, JavaScript framework, and mobile platf
- Passing the empty string to the `value` property will now error as it is not a valid ISO-8601 value. - Passing the empty string to the `value` property will now error as it is not a valid ISO-8601 value.
- The haptics when swiping the wheel picker are now enabled only on iOS.
<h4 id="version-7x-input">Input</h4> <h4 id="version-7x-input">Input</h4>
- `ionChange` is no longer emitted when the `value` of `ion-input` is modified externally. `ionChange` is only emitted from user committed changes, such as typing in the input and the input losing focus or from clicking the clear action within the input. - `ionChange` is no longer emitted when the `value` of `ion-input` is modified externally. `ionChange` is only emitted from user committed changes, such as typing in the input and the input losing focus or from clicking the clear action within the input.

View File

@ -1,5 +1,6 @@
import type { ComponentInterface, EventEmitter } from '@stencil/core'; import type { ComponentInterface, EventEmitter } from '@stencil/core';
import { Component, Element, Event, Host, Method, Prop, State, Watch, h } 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 { getIonMode } from '../../global/ionic-global';
import type { Color } from '../../interface'; import type { Color } from '../../interface';
@ -229,6 +230,12 @@ export class PickerColumnInternal implements ComponentInterface {
* the item object. * the item object.
*/ */
private initializeScrollListener = () => { 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; const { el } = this;
let timeout: any; let timeout: any;
@ -242,7 +249,7 @@ export class PickerColumnInternal implements ComponentInterface {
} }
if (!this.isScrolling) { if (!this.isScrolling) {
hapticSelectionStart(); enableHaptics && hapticSelectionStart();
this.isScrolling = true; this.isScrolling = true;
} }
@ -268,7 +275,7 @@ export class PickerColumnInternal implements ComponentInterface {
* we need to run haptics again. * we need to run haptics again.
*/ */
if (activeElement !== activeEl) { if (activeElement !== activeEl) {
hapticSelectionChanged(); enableHaptics && hapticSelectionChanged();
} }
activeEl = activeElement; activeEl = activeElement;
@ -276,7 +283,7 @@ export class PickerColumnInternal implements ComponentInterface {
timeout = setTimeout(() => { timeout = setTimeout(() => {
this.isScrolling = false; this.isScrolling = false;
hapticSelectionEnd(); enableHaptics && hapticSelectionEnd();
/** /**
* Certain tasks (such as those that * Certain tasks (such as those that