babel-plugin-assign-directive
Because in ClojureScript you cannot assign function directive, this babel plugin will assign them for you.
Add this babel plugin to your babel.config.js as a first entry:
moduleexports = ... plugins: 'babel-plugin-assign-directive' ... ;
React Native with ClojureScript
NOTE: does not work with shadow-cljs because of the shadow approach for evaluating code in the running environment.
Use js/worklet-directive
as a first block of your function.
This will be compiled into following code:
user{;return console;};
Now using this babel plugin the code will be transformed into:
user{"worklet";return console;};
Finnally appling the react-native-reanimated/plugin
will result into:
user{var {return console;};_f_closure=console:console;_fasString="function(){const{console}=this._closure;{return console.log(\"Hey I'm running on the UI thread\");}}";global;return _f;};