mkuczera / react-native-haptic-feedback

React-Native Haptic Feedback for iOS with Android similar behaviour.
MIT License
872 stars 106 forks source link

Feedback upon click, not release #7

Closed hwnprsd closed 6 years ago

hwnprsd commented 6 years ago

A key feature of Android buttons are the subtle sound and haptic they produce as feedback to touches. Using your amazing library is the closest I've come to reproducing that.

On native android, the feedback is generated immediately as the touch is encountered. But in react-native, when I use your ReactNativeHapticFeedback.trigger('selection') on a onPress, the feedback only comes on the release of the touch. Is there a way to work around this?

Also, as a feature request, can you have a sound to play on Android devices, thus completing the circle of native feedback

mkuczera commented 6 years ago

Hi, the native haptic feedback provided by android as a result of the touch is a little bit more complicated like the current solution. For example the android implementation right now is just simulating the same effect like android with really small vibrations.

I´m currently working on a further version to got a declaration, but i need some time for this.

To archieve the behaviour you mentioned, you can use the onPressIn Event on the Touchable for the haptic feedback and remain with your further code on the onPress Event.

The click sound of the native android is not a huge thing to implement. I will just think about an approach because this library is just handling actually the haptic, not any other feedback. But i will give it a try as another trigger Option :)

hwnprsd commented 6 years ago

Looking forward to it. Honestly, though. A good button press feedback is the way I separate pure native apps from react native apps these days. i would love that to be changed