Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

Cannot call another worklet from worklet

Aperta
#136 8 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Abbastanza chiara
Stato di attività
Ferma
Stack tecnologico
babel, react-native, typescript
Ambito
mobile, tooling

Direzione di ricerca

Reproduce the nested-worklet case with react-native-worklets-core 0.2.4 and react-native-reanimated 3.5.4, then compare it with the version where the worklet is hoisted. Inspect the Babel transformation and determine why an inlined worklet passed between contexts fails; done means the nested example runs correctly without requiring the workaround.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Calling an inlined worklet from an existing worklet breaks, presumably because of some mistake in the babel plugin.

This code breaks:

const context1 = Worklets.createContext('context1')
const context2 = Worklets.createContext('context2')
const runAsync = Worklets.createRunInContextFn((func: () => void) => {
  'worklet'
  try {
    // Call long-running function
    func()
  } catch (e) {
    // Re-throw error on JS Thread
    throwJSError(e)
  }
}, context2)

const runNormalWorklet = Worklets.createRunInContextFn(() => {
  'worklet'
  
  console.log('running from context1!')
  runAsync(() => {
    'worklet'
    console.log('running from context2!')
  })
}, context1)

runNormalWorklet()

But when we lift out the nested worklet function outside from the existing worklet, it works:

+ const fn = () => {
+   'worklet'
+   console.log('running from context2')
+ }

 const runNormalWorklet = Worklets.createRunInContextFn(() => {
   'worklet'
  
   console.log('running from context1!')
-  runAsync(() => {
-    'worklet'
-   console.log('running from context2!')
-  })
+  runAsync(fn)
 }, context1)

I'm guessing this is an incompatibility with the Reanimated plugin again.

    "react-native-worklets-core": "0.2.4",
    "react-native-reanimated": "^3.5.4",
Lingua principale
C++
Stelle
792
Fork
65
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di margelo/react-native-worklets-core

Tutte le issue di margelo/react-native-worklets-core

Issue simili

Altre issue su C++

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.