From 8eec1974da3dd4820d29126f17d1e14b5132c9f4 Mon Sep 17 00:00:00 2001 From: Liam DeBeasi Date: Tue, 29 Nov 2022 14:23:25 -0500 Subject: [PATCH] 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. --- BREAKING.md | 2 ++ .../picker-column-internal.tsx | 13 ++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/BREAKING.md b/BREAKING.md index 5325a4f369..cfe5a6ab10 100644 --- a/BREAKING.md +++ b/BREAKING.md @@ -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. +- The haptics when swiping the wheel picker are now enabled only on iOS. +

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. diff --git a/core/src/components/picker-column-internal/picker-column-internal.tsx b/core/src/components/picker-column-internal/picker-column-internal.tsx index 53996b4eeb..aae5b71cef 100644 --- a/core/src/components/picker-column-internal/picker-column-internal.tsx +++ b/core/src/components/picker-column-internal/picker-column-internal.tsx @@ -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