mkuczera / react-native-haptic-feedback

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

Add 4 new vibration methods and refactor code. #66

Closed rushatgabhane closed 3 years ago

rushatgabhane commented 3 years ago

Hi! This PR will add 4 new vibration methods for Android. Namely, effectClick, effectDoubleClick, effectHeavyClick, and effectTick.

Android reference to the methods can be found here.

I've also refactored RNHapticFeedbackModule.java. Now, adding different kinds of vibration in future is as easy as overriding apply() from the Vibrate interface.

VibrateFactory uses a HashMap to store all the methods. This gets rid of the long switch case for a cleaner code.

Let me know what you think. cc: @mkuczera

rushatgabhane commented 3 years ago

This library will be used in New Expensify. But the library has some useful vibration methods missing. Hence the PR.

Looking forward for your feedback, and a discussion. Thanks!

rushatgabhane commented 3 years ago

@mkuczera Requesting your review of the PR :)

mkuczera commented 3 years ago

Perfect, tried it out, works like a charm :)