File tree Expand file tree Collapse file tree 2 files changed +45
-8
lines changed Expand file tree Collapse file tree 2 files changed +45
-8
lines changed Original file line number Diff line number Diff line change 1
- import type { ISkiaValueApi } from "./types" ;
1
+ import type {
2
+ AnimationState ,
3
+ ISkiaValueApi ,
4
+ SkiaAnimation ,
5
+ SkiaClockValue ,
6
+ SkiaMutableValue ,
7
+ SkiaValue ,
8
+ } from "./types" ;
2
9
3
10
declare global {
4
11
var SkiaValueApi : ISkiaValueApi ;
5
12
}
6
13
7
14
const { SkiaValueApi } = global ;
8
- export const ValueApi = SkiaValueApi ;
15
+
16
+ const deprecatedWarning = ( ) => {
17
+ console . warn (
18
+ `Skia values are deprecated and will be removed in the next Skia release.
19
+ Please use Reanimated instead: https://shopify.github.io/react-native-skia/docs/animations/animations`
20
+ ) ;
21
+ } ;
22
+
23
+ export const ValueApi = {
24
+ createValue < T > ( initialValue : T ) : SkiaMutableValue < T > {
25
+ deprecatedWarning ( ) ;
26
+ return SkiaValueApi . createValue ( initialValue ) ;
27
+ } ,
28
+ createComputedValue < R > (
29
+ cb : ( ) => R ,
30
+ values : SkiaValue < unknown > [ ]
31
+ ) : SkiaValue < R > {
32
+ deprecatedWarning ( ) ;
33
+ return SkiaValueApi . createComputedValue ( cb , values ) ;
34
+ } ,
35
+ createClockValue ( ) : SkiaClockValue {
36
+ deprecatedWarning ( ) ;
37
+ return SkiaValueApi . createClockValue ( ) ;
38
+ } ,
39
+ createAnimation < S extends AnimationState = AnimationState > (
40
+ cb : ( t : number , state : S | undefined ) => S
41
+ ) : SkiaAnimation {
42
+ deprecatedWarning ( ) ;
43
+ return SkiaValueApi . createAnimation ( cb ) ;
44
+ } ,
45
+ } ;
Original file line number Diff line number Diff line change @@ -48,26 +48,26 @@ export interface ISkiaValueApi {
48
48
* Creates a new value that holds the initial value and that
49
49
* can be changed.
50
50
*/
51
- createValue : < T > ( initialValue : T ) => SkiaMutableValue < T > ;
51
+ createValue < T > ( initialValue : T ) : SkiaMutableValue < T > ;
52
52
/**
53
53
* Creates a computed value. This is a calculated value that returns the result of
54
54
* a function that is called with the values of the dependencies.
55
55
*/
56
- createComputedValue : < R > (
56
+ createComputedValue < R > (
57
57
cb : ( ) => R ,
58
58
values : Array < SkiaValue < unknown > >
59
- ) => SkiaValue < R > ;
59
+ ) : SkiaValue < R > ;
60
60
/**
61
61
* Creates a clock value where the value is the number of milliseconds elapsed
62
62
* since the clock was created
63
63
*/
64
- createClockValue : ( ) => SkiaClockValue ;
64
+ createClockValue ( ) : SkiaClockValue ;
65
65
/**
66
66
* Creates an animation that is driven from a clock and updated every frame.
67
67
* @param cb Callback to calculate next value from time.
68
68
* @returns An animation object that can control a value.
69
69
*/
70
- createAnimation : < S extends AnimationState = AnimationState > (
70
+ createAnimation < S extends AnimationState = AnimationState > (
71
71
cb : ( t : number , state : S | undefined ) => S
72
- ) => SkiaAnimation ;
72
+ ) : SkiaAnimation ;
73
73
}
You can’t perform that action at this time.
0 commit comments