-
Notifications
You must be signed in to change notification settings - Fork 734
Feat/add haptics to Drawer #1266
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
@@ -123,7 +125,8 @@ export default class Swipeable extends Component<Props, StateType> { | |||
if (!this.dragThresholdReached && x >= threshold && x < threshold + 10) { | |||
// move item right | |||
this.dragThresholdReached = true; | |||
onToggleSwipeLeft({rowWidth, leftWidth, dragX: x, triggerHaptic: true}); | |||
HapticService.triggerHaptic(HAPTIC_METHOD, 'Drawer'); | |||
onToggleSwipeLeft({rowWidth, leftWidth, dragX: x}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should keep the haptic optional, not all users will want to use it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not get the haptic method from the HapticService, i.e. HapticMethods.impactMedium
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll be able to do that only when I'll fix the HapticMethods
in the HapticService
as we talked about in our dev sync.
I'm waiting for this PR to be merged to do so
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok. Add the other PR as a dependency and we'll merge this after it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is the dependency merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes :)
src/components/drawer/Swipeable.tsx
Outdated
|
||
|
||
const DRAG_TOSS = 0.05; | ||
const LEFT_TOGGLE_THRESHOLD = 0.6; | ||
const HAPTIC_METHOD = HapticType.impactMedium; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this working? The other PR merged?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is not merged yet - I added a link in the description.
And yes it works, I checked it..
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're using HAPTIC_METHOD only once, why store it in a const?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, why impactMedium
is the default?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
These are the UX guidelines.
We can open it to a discussion in the future if any user will ask to change it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm asking because our private config (Drawer.config) is setting it to impactLight
, so it should be the default or it should be open for user's change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It has updated to impactMedium
, which is the default now.
Description
Add haptic feedback to the Drawer component
Jira 1201
Depending on #1277
Changelog
Add haptic feedback to the Drawer component