-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add another ways to mark function as worklet. #1310
Conversation
I'll add TS typings in the following PR. |
Co-authored-by: Terry Sahaidak <tasssik@gmail.com>
A note to make sure that it doesn't fail with this syntax: import * as Reanimated from 'reanimated'
Reanimated.createWorklet(() => {
...
}) The reason is that ReasonML compiles to this syntax. |
#1210 This PR should fix this type of imports as well. |
While I'm a big fan of this syntax, I think it would be a better name to shorten Thoughts @kmagiera @terrysahaidak @Szymon20000 ? |
The pull-request adds two methods which are the new ways for telling babel that is should transform the function into a worklet. The first is
useWorkletCallback
:which is equivalent to
The second one is
createWorklet
which just lets us omit 'worklet' mark.behaves the same as