react-native-keychain icon indicating copy to clipboard operation
react-native-keychain copied to clipboard

[Fix][Android] Avoid blocking threads to prevent deadlocks

Open frw opened this issue 2 years ago • 6 comments

Similar to https://github.com/oblador/react-native-keychain/pull/547, I've run into issues with main thread deadlocking when using this library to show a BiometricPrompt and have seen an increased rate of ANRs on Crashlytics. Upon further digging it was due to react-native-reanimated attempting to acquire a lock on the main thread, but since this library waits on the JS thread for the BiometricPrompt to show and finish on the main thread, a deadlock occurs. This library avoids blocking the JS thread by using a listener to resolve a promise when decryption finishes. Since there are no additional dependencies, this should be compatible up to API level 21.

This PR should fix https://github.com/oblador/react-native-keychain/issues/525

frw avatar Nov 13 '22 10:11 frw