jerson / react-native-fast-rsa

RSA for react native made with golang for fast performance
https://www.npmjs.com/package/react-native-fast-rsa
MIT License
35 stars 11 forks source link

Potential fix for Hermes + Android crashes with react-native-fast-rsa #46

Closed fparhat-rbi closed 2 years ago

fparhat-rbi commented 2 years ago

Hi! 👋

Firstly, thanks for your work on this project! 🙂

Today I used patch-package to patch react-native-fast-rsa@2.2.3 for the project I'm working on.

Here is the diff that solved my problem:

diff --git a/node_modules/react-native-fast-rsa/android/src/main/java/com/reactnativefastrsa/FastRsaModule.kt b/node_modules/react-native-fast-rsa/android/src/main/java/com/reactnativefastrsa/FastRsaModule.kt
index 8a03f79..71ae0da 100644
--- a/node_modules/react-native-fast-rsa/android/src/main/java/com/reactnativefastrsa/FastRsaModule.kt
+++ b/node_modules/react-native-fast-rsa/android/src/main/java/com/reactnativefastrsa/FastRsaModule.kt
@@ -62,7 +62,9 @@ internal class FastRsaModule(reactContext: ReactApplicationContext) :

     override fun initialize() {
         super.initialize()
-        initialize(this.reactApplicationContext.javaScriptContextHolder.get())
+        reactApplicationContext.runOnJSQueueThread {
+          initialize(this.reactApplicationContext.javaScriptContextHolder.get())
+        }
     }

     override fun onCatalystInstanceDestroy() {

This issue body was partially generated by patch-package.

jerson commented 2 years ago

hi @fparhat-rbi thanks for this, Im gonna apply this change and run some tests

jerson commented 2 years ago

updated and released in https://www.npmjs.com/package/react-native-fast-rsa/v/2.2.4