mkuczera / react-native-haptic-feedback

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

Fix Android Vibration enable condition #108

Closed Lavegaa closed 1 year ago

Lavegaa commented 1 year ago

Problem

There seems to be a problem with the ignoreAndroidSystemSettingsoption. Many people have no haptic response when the ignoreAndroidSystemSettingsoption is set to false, so they are using it with it set to true. (https://github.com/mkuczera/react-native-haptic-feedback/issues/97)

The previously used Settings.System.HAPTIC_FEEDBACK_ENABLED option has been deprecated and no longer returns the enabled state of haptic. Because it simply returns a string called haptic_feedback_enabled, hapticEnabledAndroidSystemSettings always has to be 0. https://developer.android.com/reference/android/provider/Settings.System#HAPTIC_FEEDBACK_ENABLED

Suggestion

So I propose a new vibration enable condition.

The first is when the device has a vibration function.

The second is when the user turns on the sound of the device or puts it in vibrate mode.

When the above two conditions are satisfied, it can be considered that the user has enabled haptic.

mkuczera commented 1 year ago

Fixed in 2.1.0, currently in beta to test it. Thanks for your PR :)

Pahkoo commented 2 months ago

Hello, may I ask if I have disabled the system's tactile feedback in my phone system or can it still generate vibrations