Cannot call another worklet from worklet
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 35/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- babel, react-native, typescript
Rechercherichtung
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.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
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",
- Vorherrschende Sprache
- C++
- Sterne
- 792
- Forks
- 65
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus margelo/react-native-worklets-core
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
-
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 35/100
margelo/react-native-worklets-core#271 · 1 Kommentar ·
-
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
margelo/react-native-worklets-core#269 · 2 Reaktionen ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 35/100
margelo/react-native-worklets-core#268 · 2 Kommentare ·
-
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 72/100
margelo/react-native-worklets-core#267 · 1 Kommentar · 1 Reaktion ·
Alle Issues in margelo/react-native-worklets-core
Ähnliche Issues
-
Broken links in the docsOffen
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 85/100
microsoft/onnxruntime#33018 ·
Maintainer antworten meist innerhalb von 2 Tagen
-
Schwierigkeit 1/5 Unter einer Stunde Anfängerfreundlichkeit 78/100
Maintainer antworten meist innerhalb von 1 Tag
-
customer-reported needs-triage question
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 76/100
Azure/azure-sdk-for-cpp#7435 ·
Maintainer antworten meist innerhalb von 1 Tag
-
ChromieCraft Generic Confirmed World Event
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
azerothcore/azerothcore-wotlk#27882 ·
Maintainer antworten meist innerhalb von 1 Tag
-
MacOS build failureOffenbug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
aristocratos/btop#1874 ·
Maintainer antworten meist innerhalb von 1 Tag