I recently started using react-native-animated
and react-native-gesture-handler
in my app. I get the following errors in release mode while using react-native-animated
hooks/components.
iOS
libc++abi: terminating due to uncaught exception of type facebook::jsi::JSError: undefined is not an object (evaluating 'fun.__workletHash')
runOnJS@
runOnJS@[native code]
setupConsole@
setupConsole@[native code]
anonymous@
anonymous@[native code]
anonymous@
anonymous@[native code]
(lldb)
Android
FATAL EXCEPTION: main
Process: com.myapp, PID: 4977
com.facebook.jni.CppException: Cannot read property '__workletHash' of undefined
TypeError: Cannot read property '__workletHash' of undefined
at runOnJS (JavaScript:1:276)
at setupConsole (JavaScript:1:187)
at anonymous (JavaScript:1:163)
at apply (native)
at anonymous (JavaScript:1:65)
at com.swmansion.reanimated.AndroidUIScheduler.triggerUI(Native Method)
at com.swmansion.reanimated.AndroidUIScheduler$1.run(AndroidUIScheduler.java:24)
at com.swmansion.reanimated.AndroidUIScheduler$2.runGuarded(AndroidUIScheduler.java:43)
at com.facebook.react.bridge.GuardedRunnable.run(GuardedRunnable.java:30)
at android.os.Handler.handleCallback(Handler.java:942)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loopOnce(Looper.java:201)
at android.os.Looper.loop(Looper.java:288)
at android.app.ActivityThread.main(ActivityThread.java:7872)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:548)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:936)
The issue only happens in release mode. The app works fine in debug mode. So, I strongly feel that it has something to do with the babel plugin setup for react-native-animated
. My app is a monorepo using yarn workspaces. I have added the required 'react-native-reanimated/plugin'
as the last plugin in babel.config.js
but I feel that it is not run properly in release mode due to the monorepo setup.
If someone has any idea how to resolve this problem, please let me know.