ionic-team / ionic-framework

A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
https://ionicframework.com
MIT License
50.71k stars 13.51k forks source link

bug: TapticEngine integration does not work with ion-picker #21266

Closed DavidStrausz closed 4 years ago

DavidStrausz commented 4 years ago

Bug Report

Ionic version: [x] 5.1

Current behavior: No taptic feedback is triggered. When selecting a value with ion-picker, during the swipe gesture there should be a "selection" feedback from the taptic engine.

I checked and triggering it manually via dev console (window.TapticEngine.selection()), which works. The issue seems to be that with Ionics' integration gestureSelectionStart() (hapticSelectionStart()) and gestureSelectionEnd() (hapticSelectionEnd()) are never called, which leads to gestureSelectionChanged() (hapticSelectionChanged()) not being effective.

Expected behavior: Taptic feedback works when the corresponding cordova-plugin is installed. See for example the implementation of ion-reorder-group where it's working.

Steps to reproduce: Use ion-picker in a cordova application with the cordova-plugin-taptic-engine installed which is running on a device which supports taptic feedback.

Related code: https://github.com/ionic-team/ionic/blob/1fbdb2255e4ff7fccf22d9ccc12b7f9bb4c3a064/core/src/components/picker-column/picker-column.tsx#L193

https://github.com/ionic-team/ionic/blob/1fbdb2255e4ff7fccf22d9ccc12b7f9bb4c3a064/core/src/utils/haptic.ts#L37

https://github.com/ionic-team/ionic/blob/f0e4215f41fdf6979f28d09531b9e7959a505b83/core/src/components/reorder-group/reorder-group.tsx#L160

Other information: I tested on an iPhone 11 Pro which has a taptic engine built in.

And I also noticed that there are two versions of the haptic util:

core/src/utils/native/haptic.ts

and

core/src/utils/haptic.ts

Ionic info:

Ionic:

   Ionic CLI                     : 6.8.0 (/usr/local/lib/node_modules/@ionic/cli)
   Ionic Framework               : @ionic/angular 5.1.0
   @angular-devkit/build-angular : 0.901.5
   @angular-devkit/schematics    : 9.1.5
   @angular/cli                  : 9.1.5
   @ionic/angular-toolkit        : 2.2.0

Cordova:

   Cordova CLI       : 9.0.0 (cordova-lib@9.0.1)
   Cordova Platforms : ios 5.1.1
   Cordova Plugins   : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 27 other plugins)

Utility:

   cordova-res : not installed
   native-run  : not installed

System:

   ios-deploy : 1.9.2
   ios-sim    : 8.0.2
   NodeJS     : v14.2.0 (/usr/local/bin/node)
   npm        : 6.14.5
   OS         : macOS Catalina
   Xcode      : Xcode 11.4.1 Build version 11E503a
liamdebeasi commented 4 years ago

Thanks for the issue. Can you try the following dev build and let me know if it resolves the issue?

npm i @ionic/angular@5.2.0-dev.202005111339.3501979

DavidStrausz commented 4 years ago

@liamdebeasi Thank you Liam, works perfectly with the dev-build :)

liamdebeasi commented 4 years ago

Thanks for the issue. This has been resolved via https://github.com/ionic-team/ionic/pull/21268, and a fix will be available in an upcoming release of Ionic Framework.

ionitron-bot[bot] commented 4 years ago

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.