@@ -18,7 +18,6 @@ import Animated, {
1818 Extrapolation ,
1919 runOnUI ,
2020 cancelAnimation ,
21- useWorkletCallback ,
2221 type WithSpringConfig ,
2322 type WithTimingConfig ,
2423 type SharedValue ,
@@ -569,13 +568,15 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
569568 //#endregion
570569
571570 //#region animation
572- const stopAnimation = useWorkletCallback ( ( ) => {
571+ const stopAnimation = useCallback ( ( ) => {
572+ 'worklet' ;
573573 cancelAnimation ( animatedPosition ) ;
574574 animatedAnimationSource . value = ANIMATION_SOURCE . NONE ;
575575 animatedAnimationState . value = ANIMATION_STATE . STOPPED ;
576576 } , [ animatedPosition , animatedAnimationState , animatedAnimationSource ] ) ;
577- const animateToPositionCompleted = useWorkletCallback (
577+ const animateToPositionCompleted = useCallback (
578578 function animateToPositionCompleted ( isFinished ?: boolean ) {
579+ 'worklet' ;
579580 if ( ! isFinished ) {
580581 return ;
581582 }
@@ -603,15 +604,17 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
603604 animatedNextPosition . value = INITIAL_VALUE ;
604605 animatedNextPositionIndex . value = INITIAL_VALUE ;
605606 animatedContainerHeightDidChange . value = false ;
606- }
607+ } ,
608+ [ ]
607609 ) ;
608- const animateToPosition : AnimateToPositionType = useWorkletCallback (
610+ const animateToPosition : AnimateToPositionType = useCallback (
609611 function animateToPosition (
610612 position : number ,
611613 source : ANIMATION_SOURCE ,
612614 velocity = 0 ,
613615 configs ?: WithTimingConfig | WithSpringConfig
614616 ) {
617+ 'worklet' ;
615618 if ( __DEV__ ) {
616619 runOnJS ( print ) ( {
617620 component : 'BottomSheet' ,
@@ -694,9 +697,10 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
694697 *
695698 * @param targetPosition position to be set.
696699 */
697- const setToPosition = useWorkletCallback ( function setToPosition (
700+ const setToPosition = useCallback ( function setToPosition (
698701 targetPosition : number
699702 ) {
703+ 'worklet' ;
700704 if (
701705 targetPosition === animatedPosition . value ||
702706 targetPosition === undefined ||
@@ -737,7 +741,7 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
737741 * Calculate and evaluate the current position based on multiple
738742 * local states.
739743 */
740- const getEvaluatedPosition = useWorkletCallback (
744+ const getEvaluatedPosition = useCallback (
741745 function getEvaluatedPosition ( source : ANIMATION_SOURCE ) {
742746 'worklet' ;
743747 const currentIndex = animatedCurrentIndex . value ;
@@ -847,11 +851,12 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
847851 /**
848852 * Evaluate the bottom sheet position based based on a event source and other local states.
849853 */
850- const evaluatePosition = useWorkletCallback (
854+ const evaluatePosition = useCallback (
851855 function evaluatePosition (
852856 source : ANIMATION_SOURCE ,
853857 animationConfigs ?: WithSpringConfig | WithTimingConfig
854858 ) {
859+ 'worklet' ;
855860 /**
856861 * if a force closing is running and source not from user, then we early exit
857862 */
@@ -1026,11 +1031,12 @@ const BottomSheetComponent = forwardRef<BottomSheet, BottomSheetProps>(
10261031 animationConfigs
10271032 ) ;
10281033 } ) ;
1029- const handleSnapToPosition = useWorkletCallback (
1034+ const handleSnapToPosition = useCallback (
10301035 function handleSnapToPosition (
10311036 position : number | string ,
10321037 animationConfigs ?: WithSpringConfig | WithTimingConfig
10331038 ) {
1039+ 'worklet' ;
10341040 if ( __DEV__ ) {
10351041 print ( {
10361042 component : BottomSheet . name ,
0 commit comments