useAnimatedStyle hook is not recognized as worklet in .tsx file #3910
Unanswered
mrvincenzo
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Well, it is not related to typescript. I create an empty React Native Typescript project from scratch and everything works there as expected. It's gotta be something else. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I have this code (from the example code) in a function component in a .tsx file
The
react-native-reanimated/plugin
doesn't recognize theuseAnimatedStyle
as worklet. I suspect that the issue may be related to the fact that it is a TS file and not a JS one. The only way around it is to add theworklet
literal inside the hook, e.g.If I don't add the worklet literal, I am getting the
Tried to synchronously call anonymous function from a different thread.
error.The
react-native-reanimated/plugin
is defined correctly inbabel.config.json
and I am running the metro bundler withnpm run start -- --reset-cache
.Is additional setup needed to make the hooks recognizable in TypeScript?
Beta Was this translation helpful? Give feedback.
All reactions