diff --git a/Common/cpp/SharedItems/ShareableValue.cpp b/Common/cpp/SharedItems/ShareableValue.cpp index a987dcf6634b..a1c77e9e08c1 100644 --- a/Common/cpp/SharedItems/ShareableValue.cpp +++ b/Common/cpp/SharedItems/ShareableValue.cpp @@ -414,8 +414,6 @@ jsi::Value ShareableValue::toJSValue(jsi::Runtime &rt) { } else { res = funPtr->call(rt, args, count); } - } catch (jsi::JSError &e) { - throw e; } catch (std::exception &e) { std::string str = e.what(); runtimeManager->errorHandler->setError(str); diff --git a/FabricExample/src/WorkletExample.tsx b/FabricExample/src/WorkletExample.tsx index 5783f1ad9b12..c81cf58e6446 100644 --- a/FabricExample/src/WorkletExample.tsx +++ b/FabricExample/src/WorkletExample.tsx @@ -1,52 +1,276 @@ +/* eslint-disable react-native/no-inline-styles */ /* global _WORKLET */ -import { Button, View, StyleSheet } from 'react-native'; -import { +import Animated, { runOnJS, runOnUI, + useAnimatedGestureHandler, + useAnimatedRef, + useAnimatedScrollHandler, + useAnimatedStyle, useDerivedValue, + useFrameCallback, + useScrollViewOffset, useSharedValue, } from 'react-native-reanimated'; +import { Button, Text, View } from 'react-native'; +import { + Gesture, + GestureDetector, + PanGestureHandler, +} from 'react-native-gesture-handler'; import React from 'react'; -export default function WorkletExample() { - // runOnUI demo - const someWorklet = (number: number) => { +declare global { + const _WORKLET: boolean; +} + +function RunOnUIDemo() { + const someWorklet = (x: number) => { 'worklet'; - console.log(_WORKLET, number); // _WORKLET should be true + console.log(_WORKLET, x); // _WORKLET should be true }; - const handlePress1 = () => { + const handlePress = () => { runOnUI(someWorklet)(Math.random()); }; - // runOnJS demo - const x = useSharedValue(0); + return