mkuczera / react-native-haptic-feedback

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

[iOs] haptic feedback does not working if mic on #71

Closed ysimoo closed 1 month ago

ysimoo commented 2 years ago

Hello,

Is there any solution to use haptic feedback when mic is active on iOs ?

React-Native: 0.63.4 expo: 42.0.1

`const options = { enableVibrateFallback: true, ignoreAndroidSystemSettings: false, };

ReactNativeHapticFeedback.trigger("selection", options); `

Thanks,

mkuczera commented 2 years ago

Will check for the circumstance

jforaker commented 2 years ago

I had the same experience using in conjunction with react-native-audio-recorder-player, and found that wrapping my record function in a setTimeout resolved the issue:

            ReactNativeHapticFeedback.trigger('impactHeavy');

            setTimeout(() => {
              startRecording();
            });
a-vikor commented 1 year ago

Natively on iOS haptic feedback is disabled during audio recording sessions not to interrupt it. Still, you can enable with

if #available(iOS 13, *) {
              do {
                    try AVAudioSession.sharedInstance().setAllowHapticsAndSystemSoundsDuringRecording(true)
                } catch {}
            }

inside the startRecording function of native source RNAudioRecorderPlayer.swift file below the settings.

image