File tree Expand file tree Collapse file tree 1 file changed +10
-4
lines changed
package/src/external/reanimated Expand file tree Collapse file tree 1 file changed +10
-4
lines changed Original file line number Diff line number Diff line change 1
- import type { ExtrapolationType , SharedValue } from "react-native-reanimated" ;
2
- import { useMemo } from "react" ;
1
+ import type {
2
+ ExtrapolationType ,
3
+ FrameInfo ,
4
+ SharedValue ,
5
+ } from "react-native-reanimated" ;
6
+ import { useMemo , useRef } from "react" ;
3
7
4
8
import type { SkPath , SkPoint } from "../../skia/types" ;
5
9
import { interpolatePaths , interpolateVector } from "../../animation" ;
@@ -19,9 +23,11 @@ export const notifyChange = (value: SharedValue<unknown>) => {
19
23
20
24
export const useClock = ( ) => {
21
25
const clock = useSharedValue ( 0 ) ;
22
- useFrameCallback ( ( info ) => {
26
+ const callback = useRef ( ( info : FrameInfo ) => {
27
+ "worklet" ;
23
28
clock . value = info . timeSinceFirstFrame ;
24
- } ) ;
29
+ } ) . current ;
30
+ useFrameCallback ( callback ) ;
25
31
return clock ;
26
32
} ;
27
33
You can’t perform that action at this time.
0 commit comments