fix(picker): haptics now work properly (#21268)

This commit is contained in:
Liam DeBeasi
2020-05-11 15:10:19 -04:00
committed by GitHub
parent 1fbdb2255e
commit 8e11ecc136
4 changed files with 6 additions and 75 deletions

View File

@ -2,8 +2,8 @@ import { Component, ComponentInterface, Element, Event, EventEmitter, Host, Prop
import { getIonMode } from '../../global/ionic-global';
import { Gesture, GestureDetail, PickerColumn } from '../../interface';
import { hapticSelectionChanged } from '../../utils/haptic';
import { clamp } from '../../utils/helpers';
import { hapticSelectionChanged, hapticSelectionEnd, hapticSelectionStart } from '../../utils/native/haptic';
/**
* @internal
@ -226,6 +226,7 @@ export class PickerColumnCmp implements ComponentInterface {
} else {
this.velocity = 0;
this.emitColChange();
hapticSelectionEnd();
}
} else if (this.y % this.optHeight !== 0) {
@ -252,6 +253,8 @@ export class PickerColumnCmp implements ComponentInterface {
detail.event.preventDefault();
detail.event.stopPropagation();
hapticSelectionStart();
// reset everything
cancelAnimationFrame(this.rafId);
const options = this.col.options;