Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

Cannot call another worklet from worklet

Abierto
#136 8 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
4/5
Tiempo estimado
3-5 días
Aptitud para principiantes
35/100
Tipo de issue
Error
Claridad
Bastante claro
Estado de actividad
Estancado
Stack tecnológico
babel, react-native, typescript
Área
mobile, tooling

Línea de trabajo

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.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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",
Lenguaje dominante
C++
Estrellas
792
Forks
65
Métricas de merge de PR
Sin PR fusionados en 30 d

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de margelo/react-native-worklets-core

Todos los issues de margelo/react-native-worklets-core

Issues similares

Más issues de C++

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.