diff --git a/src/components/CandlestickChart/CandlestickChart.tsx b/src/components/CandlestickChart/CandlestickChart.tsx index 62adc70..10b6848 100644 --- a/src/components/CandlestickChart/CandlestickChart.tsx +++ b/src/components/CandlestickChart/CandlestickChart.tsx @@ -70,14 +70,18 @@ export default memo( .enabled(enabled) .minDistance(consts.Gesture.pan.minDistance) .onBegin(({ numberOfPointers, translationX }) => { + "worklet"; pan0.value = pan.value; panNumberOfPointers.value = numberOfPointers; panTranslationX.value = translationX; }) .onStart(() => { + "worklet"; runOnJS(hideSnackbar)(); }) .onUpdate(({ numberOfPointers, translationX }) => { + "worklet"; + if (numberOfPointers <= 1) { if (panNumberOfPointers.value === numberOfPointers) { // No need to restart @@ -118,14 +122,18 @@ export default memo( Gesture.Pinch() .enabled(enabled) .onBegin(({ numberOfPointers, scale }) => { + "worklet"; pan0.value = pan.value; panNumberOfPointers.value = numberOfPointers; panScale.value = scale; }) .onStart(() => { + "worklet"; runOnJS(hideSnackbar)(); }) .onUpdate(({ numberOfPointers, scale }) => { + "worklet"; + if (numberOfPointers >= 2) { if (panNumberOfPointers.value === numberOfPointers) { // No need to restart @@ -158,6 +166,8 @@ export default memo( }) ), Gesture.Tap().onEnd(({ x }) => { + "worklet"; + const dataWidth = width - paddingStart - paddingEnd; const barCount = pan0.value[1] - pan0.value[0]; diff --git a/src/components/DateTimePicker/Calendar/index.tsx b/src/components/DateTimePicker/Calendar/index.tsx index a9fb573..e6a252d 100644 --- a/src/components/DateTimePicker/Calendar/index.tsx +++ b/src/components/DateTimePicker/Calendar/index.tsx @@ -153,12 +153,15 @@ export default memo( Gesture.Pan() .minDistance(consts.Gesture.pan.minDistance) .onBegin(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.start); }) .onUpdate(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.update); }) .onFinalize(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.end); }), [setRange] diff --git a/src/components/DateTimePicker/Clock/index.tsx b/src/components/DateTimePicker/Clock/index.tsx index 86b037c..d7e59ea 100644 --- a/src/components/DateTimePicker/Clock/index.tsx +++ b/src/components/DateTimePicker/Clock/index.tsx @@ -262,12 +262,15 @@ export default memo( Gesture.Pan() .minDistance(consts.Gesture.pan.minDistance) .onBegin(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.start); }) .onUpdate(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.update); }) .onFinalize(({ x, y }) => { + "worklet"; setRange(x, y, GestureStep.end); }), [setRange] diff --git a/src/components/Drawer.tsx b/src/components/Drawer.tsx index 95bb9d8..15e6ff7 100644 --- a/src/components/Drawer.tsx +++ b/src/components/Drawer.tsx @@ -253,6 +253,8 @@ export default memo( Gesture.Pan() .minDistance(consts.Gesture.pan.minDistance) .onTouchesDown(({ allTouches }, { fail }) => { + "worklet"; + if ( active.value || (dragToOpen && @@ -265,12 +267,14 @@ export default memo( } else fail(); }) .onBegin(event => { + "worklet"; cancelAnimation(pan); pan0.value = pan.value - Math.max(inboundValue(event.x, event.y) / size.value - 1, 0); }) .onStart(() => { + "worklet"; runOnJS(hideSnackbar)(); if (active.value) { @@ -284,12 +288,16 @@ export default memo( busy.value = true; }) .onUpdate(event => { + "worklet"; pan.value = gestureValue(event); }) .onEnd(() => { + "worklet"; busy.value = false; }) .onFinalize(event => { + "worklet"; + if (active.value) if (pan.value === 1) { active.value = false; @@ -349,11 +357,14 @@ export default memo( }), Gesture.Tap() .onTouchesDown((_event, { fail }) => { + "worklet"; + if (active.value) { // Tappable } else fail(); }) .onEnd(() => { + "worklet"; runOnJS(hideSnackbar)(); runOnJS(moveOut)(); }) diff --git a/src/components/Swipeable.tsx b/src/components/Swipeable.tsx index 0846854..fbe1df8 100644 --- a/src/components/Swipeable.tsx +++ b/src/components/Swipeable.tsx @@ -91,6 +91,8 @@ export default memo( Gesture.Pan() .manualActivation(true) .onTouchesDown(({ allTouches }, { fail }) => { + "worklet"; + const touch = allTouches[0]; if (activated.value) { @@ -106,6 +108,8 @@ export default memo( else fail(); }) .onTouchesMove(({ allTouches }, { activate, fail }) => { + "worklet"; + const touch = allTouches[0]; if (activated.value) { @@ -129,18 +133,22 @@ export default memo( } else fail(); }) .onStart(() => { + "worklet"; cancelAnimation(pan); activated.value = true; pan0.value = pan.value; panOpacity.value = 0; }) .onUpdate(event => { + "worklet"; pan.value = pan0.value + event.translationX; }) .onEnd(event => { + "worklet"; runOnJS(onEnd)(event); }) .onFinalize(() => { + "worklet"; activated.value = false; }), [activated, initialTouch, layout, onEnd, pan, pan0, panOpacity, threshold] diff --git a/src/components/common-components/AnimatedScrollView.tsx b/src/components/common-components/AnimatedScrollView.tsx index 330e5d7..98096cf 100644 --- a/src/components/common-components/AnimatedScrollView.tsx +++ b/src/components/common-components/AnimatedScrollView.tsx @@ -151,17 +151,23 @@ export default memo( Gesture.Pan() .minDistance(consts.Gesture.pan.minDistance) .onTouchesDown((_event, { fail }) => { + "worklet"; + if (disabled && disabled.value) fail(); }) .onBegin(() => { + "worklet"; cancelAnimation(pan); pan0.value = pan.value; panLastStop.value = pan.value; }) .onStart(() => { + "worklet"; runOnJS(hideSnackbar)(); }) .onUpdate(event => { + "worklet"; + const delta = getDelta(event); const velocity = getVelocity(event); @@ -176,6 +182,8 @@ export default memo( runOnJS(onScroll)(value); }) .onFinalize(event => { + "worklet"; + const delta = getDelta(event); const velocity = getVelocity(event); diff --git a/src/contexts/snackbar.tsx b/src/contexts/snackbar.tsx index de5af74..dfaf5f6 100644 --- a/src/contexts/snackbar.tsx +++ b/src/contexts/snackbar.tsx @@ -48,6 +48,7 @@ export const SnackbarProvider = memo( const gesture = React.useMemo( () => Gesture.Tap().onEnd(() => { + "worklet"; runOnJS(hideSnackbar)(); }), [hideSnackbar]