oblador / react-native-keychain

:key: Keychain Access for React Native
MIT License
3.12k stars 515 forks source link

UI animation freezing when calling any `set` functions in Android #640

Open jja08111 opened 1 week ago

jja08111 commented 1 week ago

The UI animation freezes for around 200-300ms when calling any set functions in Android.

Minimal reproducible example

HomeScreen.tsx

export default function HomeScreen() {
  return (
    <View>
      <TouchableOpacity onPress={() => KeyChain.setInternetCredentials('name', 'username', 'password')}>
        <Text>Set keychain</Text>
      </TouchableOpacity>
    </View>
  );
}

Problem

I think the encryptString function should be run on another thread because the stream handling method causes the UI thread to block.

https://github.com/oblador/react-native-keychain/blob/4d88b620756f337de0e91aaac7ad4ffa3a4cb14e/android/src/main/java/com/oblador/keychain/cipherStorage/CipherStorageBase.java#L340-L367

Thank you for your attention.

lurdharry commented 4 days ago

this is a very urgent issue