@shopify/react-native-skia 1.2.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- package/android/src/main/java/com/shopify/reactnative/skia/ViewScreenshotService.java +13 -8
- package/cpp/rnskia/RNSkPlatformContext.h +2 -2
- package/ios/RNSkia-iOS/RNSkiOSPlatformContext.mm +1 -5
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.h +42 -7
- package/ios/RNSkia-iOS/SkiaCVPixelBufferUtils.mm +178 -5
- package/ios/RNSkia-iOS/SkiaMetalSurfaceFactory.mm +8 -11
- package/lib/commonjs/external/ModuleProxy.d.ts +10 -0
- package/lib/commonjs/external/ModuleProxy.js +36 -0
- package/lib/commonjs/external/ModuleProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js +18 -0
- package/lib/commonjs/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/commonjs/external/reanimated/buffers.js +9 -6
- package/lib/commonjs/external/reanimated/buffers.js.map +1 -1
- package/lib/commonjs/external/reanimated/interpolators.js +8 -7
- package/lib/commonjs/external/reanimated/interpolators.js.map +1 -1
- package/lib/commonjs/external/reanimated/renderHelpers.js +27 -11
- package/lib/commonjs/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/commonjs/external/reanimated/textures.js +4 -3
- package/lib/commonjs/external/reanimated/textures.js.map +1 -1
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js +6 -6
- package/lib/commonjs/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js +6 -5
- package/lib/commonjs/external/reanimated/useDerivedValueOnJS.js.map +1 -1
- package/lib/commonjs/renderer/Offscreen.js +1 -5
- package/lib/commonjs/renderer/Offscreen.js.map +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.d.ts +1 -1
- package/lib/commonjs/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/commonjs/specs/NativeSkiaModule.web.d.ts +0 -2
- package/lib/commonjs/specs/NativeSkiaModule.web.js +0 -8
- package/lib/commonjs/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/module/external/ModuleProxy.d.ts +10 -0
- package/lib/module/external/ModuleProxy.js +28 -0
- package/lib/module/external/ModuleProxy.js.map +1 -0
- package/lib/module/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js +12 -0
- package/lib/module/external/reanimated/ReanimatedProxy.js.map +1 -0
- package/lib/module/external/reanimated/buffers.js +8 -6
- package/lib/module/external/reanimated/buffers.js.map +1 -1
- package/lib/module/external/reanimated/interpolators.js +7 -7
- package/lib/module/external/reanimated/interpolators.js.map +1 -1
- package/lib/module/external/reanimated/renderHelpers.js +26 -11
- package/lib/module/external/reanimated/renderHelpers.js.map +1 -1
- package/lib/module/external/reanimated/textures.js +3 -3
- package/lib/module/external/reanimated/textures.js.map +1 -1
- package/lib/module/external/reanimated/useAnimatedImageValue.js +5 -6
- package/lib/module/external/reanimated/useAnimatedImageValue.js.map +1 -1
- package/lib/module/external/reanimated/useDerivedValueOnJS.js +5 -5
- package/lib/module/external/reanimated/useDerivedValueOnJS.js.map +1 -1
- package/lib/module/renderer/Offscreen.js +1 -5
- package/lib/module/renderer/Offscreen.js.map +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.d.ts +1 -1
- package/lib/module/skia/types/NativeBuffer/NativeBufferFactory.js.map +1 -1
- package/lib/module/specs/NativeSkiaModule.web.d.ts +0 -2
- package/lib/module/specs/NativeSkiaModule.web.js +0 -3
- package/lib/module/specs/NativeSkiaModule.web.js.map +1 -1
- package/lib/typescript/src/external/ModuleProxy.d.ts +10 -0
- package/lib/typescript/src/external/reanimated/ReanimatedProxy.d.ts +3 -0
- package/lib/typescript/src/skia/types/NativeBuffer/NativeBufferFactory.d.ts +1 -1
- package/lib/typescript/src/specs/NativeSkiaModule.web.d.ts +0 -2
- package/libs/ios/libskia.xcframework/Info.plist +5 -5
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e/libskia.a +0 -0
- package/libs/ios/libskia.xcframework/ios-arm64_arm64e_x86_64-simulator/libskia.a +0 -0
- package/libs/ios/libskottie.xcframework/Info.plist +5 -5
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e/libskottie.a +0 -0
- package/libs/ios/libskottie.xcframework/ios-arm64_arm64e_x86_64-simulator/libskottie.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e/libskparagraph.a +0 -0
- package/libs/ios/libskparagraph.xcframework/ios-arm64_arm64e_x86_64-simulator/libskparagraph.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e/libsksg.a +0 -0
- package/libs/ios/libsksg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsksg.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e/libskshaper.a +0 -0
- package/libs/ios/libskshaper.xcframework/ios-arm64_arm64e_x86_64-simulator/libskshaper.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e/libskunicode.a +0 -0
- package/libs/ios/libskunicode.xcframework/ios-arm64_arm64e_x86_64-simulator/libskunicode.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e/libsvg.a +0 -0
- package/libs/ios/libsvg.xcframework/ios-arm64_arm64e_x86_64-simulator/libsvg.a +0 -0
- package/package.json +1 -1
- package/src/external/ModuleProxy.ts +30 -0
- package/src/external/reanimated/ReanimatedProxy.ts +18 -0
- package/src/external/reanimated/buffers.ts +7 -6
- package/src/external/reanimated/interpolators.ts +7 -12
- package/src/external/reanimated/renderHelpers.ts +31 -18
- package/src/external/reanimated/textures.tsx +3 -3
- package/src/external/reanimated/useAnimatedImageValue.ts +5 -10
- package/src/external/reanimated/useDerivedValueOnJS.ts +5 -10
- package/src/renderer/Offscreen.tsx +1 -7
- package/src/skia/types/NativeBuffer/NativeBufferFactory.ts +1 -1
- package/src/specs/NativeSkiaModule.web.ts +0 -4
- package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java +0 -34
- package/cpp/skia/include/gpu/GrBackendDrawableInfo.h +0 -9
- package/lib/commonjs/external/reanimated/moduleWrapper.d.ts +0 -15
- package/lib/commonjs/external/reanimated/moduleWrapper.js +0 -46
- package/lib/commonjs/external/reanimated/moduleWrapper.js.map +0 -1
- package/lib/module/external/reanimated/moduleWrapper.d.ts +0 -15
- package/lib/module/external/reanimated/moduleWrapper.js +0 -37
- package/lib/module/external/reanimated/moduleWrapper.js.map +0 -1
- package/lib/typescript/src/external/reanimated/moduleWrapper.d.ts +0 -15
- package/src/external/reanimated/moduleWrapper.ts +0 -83
@@ -10,12 +10,7 @@ import { interpolatePaths, interpolateVector } from "../../animation";
|
|
10
10
|
import { Skia } from "../../skia";
|
11
11
|
import { isOnMainThread } from "../../renderer/Offscreen";
|
12
12
|
|
13
|
-
import
|
14
|
-
useAnimatedReaction,
|
15
|
-
useFrameCallback,
|
16
|
-
useSharedValue,
|
17
|
-
useDerivedValue,
|
18
|
-
} from "./moduleWrapper";
|
13
|
+
import Rea from "./ReanimatedProxy";
|
19
14
|
|
20
15
|
export const notifyChange = (value: SharedValue<unknown>) => {
|
21
16
|
"worklet";
|
@@ -27,8 +22,8 @@ export const notifyChange = (value: SharedValue<unknown>) => {
|
|
27
22
|
|
28
23
|
export const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {
|
29
24
|
const pathInit = useMemo(() => Skia.Path.Make(), []);
|
30
|
-
const path = useSharedValue(pathInit);
|
31
|
-
useDerivedValue(() => {
|
25
|
+
const path = Rea.useSharedValue(pathInit);
|
26
|
+
Rea.useDerivedValue(() => {
|
32
27
|
path.value.reset();
|
33
28
|
if (init !== undefined) {
|
34
29
|
path.value.addPath(init);
|
@@ -40,7 +35,7 @@ export const usePathValue = (cb: (path: SkPath) => void, init?: SkPath) => {
|
|
40
35
|
};
|
41
36
|
|
42
37
|
export const useClock = () => {
|
43
|
-
const clock = useSharedValue(0);
|
38
|
+
const clock = Rea.useSharedValue(0);
|
44
39
|
const callback = useCallback(
|
45
40
|
(info: FrameInfo) => {
|
46
41
|
"worklet";
|
@@ -48,7 +43,7 @@ export const useClock = () => {
|
|
48
43
|
},
|
49
44
|
[clock]
|
50
45
|
);
|
51
|
-
useFrameCallback(callback);
|
46
|
+
Rea.useFrameCallback(callback);
|
52
47
|
return clock;
|
53
48
|
};
|
54
49
|
|
@@ -73,8 +68,8 @@ const useInterpolator = <T>(
|
|
73
68
|
) => {
|
74
69
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
75
70
|
const init = useMemo(() => factory(), []);
|
76
|
-
const result = useSharedValue(init);
|
77
|
-
useAnimatedReaction(
|
71
|
+
const result = Rea.useSharedValue(init);
|
72
|
+
Rea.useAnimatedReaction(
|
78
73
|
() => value.value,
|
79
74
|
(val) => {
|
80
75
|
result.value = interpolator(val, input, output, options, result.value);
|
@@ -4,26 +4,39 @@ import type { Container } from "../../renderer/Container";
|
|
4
4
|
import type { AnimatedProps } from "../../renderer/processors";
|
5
5
|
import type { Node } from "../../dom/types";
|
6
6
|
|
7
|
-
import
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
7
|
+
import Rea from "./ReanimatedProxy";
|
8
|
+
|
9
|
+
let HAS_REANIMATED = false;
|
10
|
+
let HAS_REANIMATED_3 = false;
|
11
|
+
try {
|
12
|
+
require("react-native-reanimated");
|
13
|
+
HAS_REANIMATED = true;
|
14
|
+
const reanimatedVersion =
|
15
|
+
require("react-native-reanimated/package.json").version;
|
16
|
+
if (
|
17
|
+
reanimatedVersion &&
|
18
|
+
(reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
|
19
|
+
) {
|
20
|
+
HAS_REANIMATED_3 = true;
|
21
|
+
}
|
22
|
+
} catch (e) {
|
23
|
+
HAS_REANIMATED = false;
|
24
|
+
}
|
15
25
|
|
16
26
|
const _bindings = new WeakMap<Node<unknown>, unknown>();
|
17
27
|
|
18
28
|
export const unbindReanimatedNode = (node: Node<unknown>) => {
|
29
|
+
if (!HAS_REANIMATED) {
|
30
|
+
return;
|
31
|
+
}
|
19
32
|
const previousMapperId = _bindings.get(node);
|
20
33
|
if (previousMapperId !== undefined) {
|
21
|
-
stopMapper(previousMapperId as number);
|
34
|
+
Rea.stopMapper(previousMapperId as number);
|
22
35
|
}
|
23
36
|
};
|
24
37
|
|
25
38
|
export function extractReanimatedProps(props: AnimatedProps<any>) {
|
26
|
-
if (!
|
39
|
+
if (!HAS_REANIMATED) {
|
27
40
|
return [props, {}];
|
28
41
|
}
|
29
42
|
const reanimatedProps = {} as AnimatedProps<any>;
|
@@ -33,7 +46,7 @@ export function extractReanimatedProps(props: AnimatedProps<any>) {
|
|
33
46
|
continue;
|
34
47
|
}
|
35
48
|
const propValue = props[propName];
|
36
|
-
if (isSharedValue(propValue)) {
|
49
|
+
if (Rea.isSharedValue(propValue)) {
|
37
50
|
reanimatedProps[propName] = propValue;
|
38
51
|
otherProps[propName] = propValue.value;
|
39
52
|
} else {
|
@@ -51,7 +64,7 @@ function bindReanimatedProps2(
|
|
51
64
|
const sharedValues = Object.values(reanimatedProps);
|
52
65
|
const previousMapperId = _bindings.get(node);
|
53
66
|
if (previousMapperId !== undefined) {
|
54
|
-
stopMapper(previousMapperId as number);
|
67
|
+
Rea.stopMapper(previousMapperId as number);
|
55
68
|
}
|
56
69
|
if (sharedValues.length > 0) {
|
57
70
|
const viewId = container.getNativeId();
|
@@ -70,9 +83,9 @@ function bindReanimatedProps2(
|
|
70
83
|
container.redraw();
|
71
84
|
}
|
72
85
|
};
|
73
|
-
const mapperId = startMapper(() => {
|
86
|
+
const mapperId = Rea.startMapper(() => {
|
74
87
|
"worklet";
|
75
|
-
runOnJS(updateProps)();
|
88
|
+
Rea.runOnJS(updateProps)();
|
76
89
|
}, sharedValues);
|
77
90
|
_bindings.set(node, mapperId);
|
78
91
|
}
|
@@ -83,21 +96,21 @@ export function bindReanimatedProps(
|
|
83
96
|
node: Node<any>,
|
84
97
|
reanimatedProps: AnimatedProps<any>
|
85
98
|
) {
|
86
|
-
if (
|
99
|
+
if (HAS_REANIMATED && !HAS_REANIMATED_3) {
|
87
100
|
return bindReanimatedProps2(container, node, reanimatedProps);
|
88
101
|
}
|
89
|
-
if (!
|
102
|
+
if (!HAS_REANIMATED) {
|
90
103
|
return;
|
91
104
|
}
|
92
105
|
const sharedValues = Object.values(reanimatedProps);
|
93
106
|
const previousMapperId = _bindings.get(node);
|
94
107
|
if (previousMapperId !== undefined) {
|
95
|
-
stopMapper(previousMapperId as number);
|
108
|
+
Rea.stopMapper(previousMapperId as number);
|
96
109
|
}
|
97
110
|
if (sharedValues.length > 0) {
|
98
111
|
const viewId = container.getNativeId();
|
99
112
|
const { SkiaViewApi } = global;
|
100
|
-
const mapperId = startMapper(() => {
|
113
|
+
const mapperId = Rea.startMapper(() => {
|
101
114
|
"worklet";
|
102
115
|
if (node) {
|
103
116
|
for (const propName in reanimatedProps) {
|
@@ -14,7 +14,7 @@ import {
|
|
14
14
|
} from "../../renderer/Offscreen";
|
15
15
|
import { Skia, useImage } from "../../skia";
|
16
16
|
|
17
|
-
import
|
17
|
+
import Rea from "./ReanimatedProxy";
|
18
18
|
|
19
19
|
const createTexture = (
|
20
20
|
texture: SharedValue<SkImage | null>,
|
@@ -57,10 +57,10 @@ export const usePictureAsTexture = (
|
|
57
57
|
picture: SkPicture | null,
|
58
58
|
size: SkSize
|
59
59
|
) => {
|
60
|
-
const texture = useSharedValue<SkImage | null>(null);
|
60
|
+
const texture = Rea.useSharedValue<SkImage | null>(null);
|
61
61
|
useEffect(() => {
|
62
62
|
if (picture !== null) {
|
63
|
-
runOnUI(createTexture)(texture, picture, size);
|
63
|
+
Rea.runOnUI(createTexture)(texture, picture, size);
|
64
64
|
}
|
65
65
|
}, [texture, picture, size]);
|
66
66
|
return texture;
|
@@ -4,11 +4,7 @@ import { type FrameInfo, type SharedValue } from "react-native-reanimated";
|
|
4
4
|
import { useAnimatedImage } from "../../skia/core/AnimatedImage";
|
5
5
|
import type { DataSourceParam, SkImage } from "../../skia/types";
|
6
6
|
|
7
|
-
import
|
8
|
-
throwOnMissingReanimated,
|
9
|
-
useFrameCallback,
|
10
|
-
useSharedValue,
|
11
|
-
} from "./moduleWrapper";
|
7
|
+
import Rea from "./ReanimatedProxy";
|
12
8
|
|
13
9
|
const DEFAULT_FRAME_DURATION = 60;
|
14
10
|
|
@@ -16,11 +12,10 @@ export const useAnimatedImageValue = (
|
|
16
12
|
source: DataSourceParam,
|
17
13
|
paused?: SharedValue<boolean>
|
18
14
|
) => {
|
19
|
-
|
20
|
-
const defaultPaused = useSharedValue(false);
|
15
|
+
const defaultPaused = Rea.useSharedValue(false);
|
21
16
|
const isPaused = paused ?? defaultPaused;
|
22
|
-
const currentFrame = useSharedValue<null | SkImage>(null);
|
23
|
-
const lastTimestamp = useSharedValue(-1);
|
17
|
+
const currentFrame = Rea.useSharedValue<null | SkImage>(null);
|
18
|
+
const lastTimestamp = Rea.useSharedValue(-1);
|
24
19
|
const animatedImage = useAnimatedImage(
|
25
20
|
source,
|
26
21
|
(err) => {
|
@@ -32,7 +27,7 @@ export const useAnimatedImageValue = (
|
|
32
27
|
const frameDuration =
|
33
28
|
animatedImage?.currentFrameDuration() || DEFAULT_FRAME_DURATION;
|
34
29
|
|
35
|
-
useFrameCallback((frameInfo: FrameInfo) => {
|
30
|
+
Rea.useFrameCallback((frameInfo: FrameInfo) => {
|
36
31
|
if (!animatedImage) {
|
37
32
|
currentFrame.value = null;
|
38
33
|
return;
|
@@ -1,11 +1,6 @@
|
|
1
1
|
import { useEffect, useMemo } from "react";
|
2
2
|
|
3
|
-
import
|
4
|
-
useSharedValue,
|
5
|
-
runOnJS,
|
6
|
-
startMapper,
|
7
|
-
stopMapper,
|
8
|
-
} from "./moduleWrapper";
|
3
|
+
import Rea from "./ReanimatedProxy";
|
9
4
|
|
10
5
|
export const useDerivedValueOnJS = (
|
11
6
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
@@ -13,13 +8,13 @@ export const useDerivedValueOnJS = (
|
|
13
8
|
deps: unknown[]
|
14
9
|
) => {
|
15
10
|
const init = useMemo(() => fn(), [fn]);
|
16
|
-
const value = useSharedValue(init);
|
11
|
+
const value = Rea.useSharedValue(init);
|
17
12
|
useEffect(() => {
|
18
|
-
const mapperId = startMapper(() => {
|
13
|
+
const mapperId = Rea.startMapper(() => {
|
19
14
|
"worklet";
|
20
|
-
runOnJS(fn)();
|
15
|
+
Rea.runOnJS(fn)();
|
21
16
|
}, deps);
|
22
|
-
return () => stopMapper(mapperId);
|
17
|
+
return () => Rea.stopMapper(mapperId);
|
23
18
|
}, [deps, fn]);
|
24
19
|
return value;
|
25
20
|
};
|
@@ -32,16 +32,10 @@ export const drawAsImage = (element: ReactElement, size: SkSize) => {
|
|
32
32
|
return drawAsImageFromPicture(drawAsPicture(element), size);
|
33
33
|
};
|
34
34
|
|
35
|
-
// TODO: We're not sure yet why PixelRatio is not needed here.
|
36
|
-
const pd = 1;
|
37
35
|
export const drawAsImageFromPicture = (picture: SkPicture, size: SkSize) => {
|
38
36
|
"worklet";
|
39
|
-
const surface = Skia.Surface.MakeOffscreen(
|
40
|
-
size.width * pd,
|
41
|
-
size.height * pd
|
42
|
-
)!;
|
37
|
+
const surface = Skia.Surface.MakeOffscreen(size.width, size.height)!;
|
43
38
|
const canvas = surface.getCanvas();
|
44
|
-
canvas.scale(pd, pd);
|
45
39
|
canvas.drawPicture(picture);
|
46
40
|
surface.flush();
|
47
41
|
const image = surface.makeImageSnapshot();
|
package/android/src/paper/java/com/facebook/react/viewmanagers/SkiaDrawViewManagerDelegate.java
DELETED
@@ -1,34 +0,0 @@
|
|
1
|
-
/**
|
2
|
-
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
3
|
-
*
|
4
|
-
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
5
|
-
* once the code is regenerated.
|
6
|
-
*
|
7
|
-
* @generated by codegen project: GeneratePropsJavaDelegate.js
|
8
|
-
*/
|
9
|
-
|
10
|
-
package com.facebook.react.viewmanagers;
|
11
|
-
|
12
|
-
import android.view.View;
|
13
|
-
import androidx.annotation.Nullable;
|
14
|
-
import com.facebook.react.uimanager.BaseViewManagerDelegate;
|
15
|
-
import com.facebook.react.uimanager.BaseViewManagerInterface;
|
16
|
-
|
17
|
-
public class SkiaDrawViewManagerDelegate<T extends View, U extends BaseViewManagerInterface<T> & SkiaDrawViewManagerInterface<T>> extends BaseViewManagerDelegate<T, U> {
|
18
|
-
public SkiaDrawViewManagerDelegate(U viewManager) {
|
19
|
-
super(viewManager);
|
20
|
-
}
|
21
|
-
@Override
|
22
|
-
public void setProperty(T view, String propName, @Nullable Object value) {
|
23
|
-
switch (propName) {
|
24
|
-
case "mode":
|
25
|
-
mViewManager.setMode(view, value == null ? null : (String) value);
|
26
|
-
break;
|
27
|
-
case "debug":
|
28
|
-
mViewManager.setDebug(view, value == null ? false : (boolean) value);
|
29
|
-
break;
|
30
|
-
default:
|
31
|
-
super.setProperty(view, propName, value);
|
32
|
-
}
|
33
|
-
}
|
34
|
-
}
|
@@ -1,9 +0,0 @@
|
|
1
|
-
/*
|
2
|
-
* Copyright 2018 Google Inc.
|
3
|
-
*
|
4
|
-
* Use of this source code is governed by a BSD-style license that can be
|
5
|
-
* found in the LICENSE file.
|
6
|
-
*/
|
7
|
-
|
8
|
-
// TODO(kjlubick) delete after Chrome (and Android?) are migrated.
|
9
|
-
#include "include/gpu/ganesh/vk/GrBackendDrawableInfo.h"
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { DependencyList } from "react";
|
2
|
-
import type { DerivedValue, FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
|
3
|
-
export declare const HAS_REANIMATED2: boolean;
|
4
|
-
export declare const HAS_REANIMATED3: boolean;
|
5
|
-
export declare function throwOnMissingReanimated(): void;
|
6
|
-
export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
|
7
|
-
export declare const useDerivedValue: <T>(processor: () => T, dependencies?: DependencyList) => DerivedValue<T>;
|
8
|
-
export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
|
9
|
-
export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
|
10
|
-
export declare const stopMapper: (mapperID: number) => void;
|
11
|
-
export declare const runOnJS: any;
|
12
|
-
export declare const runOnUI: any;
|
13
|
-
export declare const makeMutable: <T>(val: T) => SharedValue<T>;
|
14
|
-
export declare const useAnimatedReaction: <T>(prepare: () => T, react: (v: T) => void, dependencies?: DependencyList) => void;
|
15
|
-
export declare const isSharedValue: <T>(value: unknown) => value is SharedValue<T>;
|
@@ -1,46 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
4
|
-
value: true
|
5
|
-
});
|
6
|
-
exports.stopMapper = exports.startMapper = exports.runOnUI = exports.runOnJS = exports.makeMutable = exports.isSharedValue = exports.HAS_REANIMATED3 = exports.HAS_REANIMATED2 = void 0;
|
7
|
-
exports.throwOnMissingReanimated = throwOnMissingReanimated;
|
8
|
-
exports.useSharedValue = exports.useFrameCallback = exports.useDerivedValue = exports.useAnimatedReaction = void 0;
|
9
|
-
var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5, _Reanimated6, _Reanimated7, _Reanimated8, _Reanimated9;
|
10
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
11
|
-
|
12
|
-
// This one is needed for the deprecated useSharedValue function
|
13
|
-
// We can remove it once we remove the deprecation
|
14
|
-
|
15
|
-
let Reanimated2;
|
16
|
-
let Reanimated3;
|
17
|
-
let reanimatedVersion;
|
18
|
-
try {
|
19
|
-
Reanimated2 = require("react-native-reanimated");
|
20
|
-
reanimatedVersion = require("react-native-reanimated/package.json").version;
|
21
|
-
if (reanimatedVersion && (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))) {
|
22
|
-
Reanimated3 = Reanimated2;
|
23
|
-
}
|
24
|
-
} catch (e) {}
|
25
|
-
const HAS_REANIMATED2 = exports.HAS_REANIMATED2 = !!Reanimated2;
|
26
|
-
const HAS_REANIMATED3 = exports.HAS_REANIMATED3 = !!Reanimated3;
|
27
|
-
function throwOnMissingReanimated() {
|
28
|
-
if (!HAS_REANIMATED2) {
|
29
|
-
throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
|
30
|
-
react-native-skia's integration layer API.");
|
31
|
-
}
|
32
|
-
}
|
33
|
-
const useSharedValue = exports.useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || throwOnMissingReanimated;
|
34
|
-
const useDerivedValue = exports.useDerivedValue = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.useDerivedValue) || throwOnMissingReanimated;
|
35
|
-
const useFrameCallback = exports.useFrameCallback = ((_Reanimated3 = Reanimated2) === null || _Reanimated3 === void 0 ? void 0 : _Reanimated3.useFrameCallback) || throwOnMissingReanimated;
|
36
|
-
const startMapper = exports.startMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.startMapper) || throwOnMissingReanimated;
|
37
|
-
const stopMapper = exports.stopMapper = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.stopMapper) || throwOnMissingReanimated;
|
38
|
-
const runOnJS = exports.runOnJS = ((_Reanimated6 = Reanimated2) === null || _Reanimated6 === void 0 ? void 0 : _Reanimated6.runOnJS) || throwOnMissingReanimated;
|
39
|
-
const runOnUI = exports.runOnUI = ((_Reanimated7 = Reanimated2) === null || _Reanimated7 === void 0 ? void 0 : _Reanimated7.runOnUI) || throwOnMissingReanimated;
|
40
|
-
const makeMutable = exports.makeMutable = ((_Reanimated8 = Reanimated2) === null || _Reanimated8 === void 0 ? void 0 : _Reanimated8.makeMutable) || throwOnMissingReanimated;
|
41
|
-
const useAnimatedReaction = exports.useAnimatedReaction = ((_Reanimated9 = Reanimated2) === null || _Reanimated9 === void 0 ? void 0 : _Reanimated9.useAnimatedReaction) || throwOnMissingReanimated;
|
42
|
-
const isSharedValue = value => {
|
43
|
-
return !!value && (Reanimated3 ? Reanimated3.isSharedValue(value) : value.value !== undefined);
|
44
|
-
};
|
45
|
-
exports.isSharedValue = isSharedValue;
|
46
|
-
//# sourceMappingURL=moduleWrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","exports","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","_Reanimated","useDerivedValue","_Reanimated2","useFrameCallback","_Reanimated3","startMapper","_Reanimated4","stopMapper","_Reanimated5","runOnJS","_Reanimated6","runOnUI","_Reanimated7","makeMutable","_Reanimated8","useAnimatedReaction","_Reanimated9","isSharedValue","value","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DependencyList } from \"react\";\nimport type {\n DerivedValue,\n FrameCallback,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion = require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nexport const useSharedValue: <T>(\n init: T,\n oneWayReadsOnly?: boolean\n) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;\n\nexport const useDerivedValue: <T>(\n processor: () => T,\n dependencies?: DependencyList\n) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;\n\nexport const useFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n autostart?: boolean\n) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper: (\n worklet: () => void,\n inputs?: unknown[],\n outputs?: unknown[]\n) => number = Reanimated2?.startMapper || throwOnMissingReanimated;\n\nexport const stopMapper: (mapperID: number) => void =\n Reanimated2?.stopMapper || throwOnMissingReanimated;\n\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;\nexport const makeMutable: <T>(val: T) => SharedValue<T> =\n Reanimated2?.makeMutable || throwOnMissingReanimated;\n\nexport const useAnimatedReaction: <T>(\n prepare: () => T,\n react: (v: T) => void,\n dependencies?: DependencyList\n) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;\n\nexport const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";;;;;;;;;AAAA;;AASA;AACA;;AAEA,IAAIA,WAAgB;AAEpB,IAAIC,WAAgB;AACpB,IAAIC,iBAAyB;AAE7B,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAyB,CAAC;EAChDD,iBAAiB,GAAGC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EAC3E,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,WAAW,GAAGD,WAAW;EAC3B;AACF,CAAC,CAAC,OAAOM,CAAC,EAAE,CAAC;AAEN,MAAMC,eAAe,GAAAC,OAAA,CAAAD,eAAA,GAAG,CAAC,CAACP,WAAW;AACrC,MAAMS,eAAe,GAAAD,OAAA,CAAAC,eAAA,GAAG,CAAC,CAACR,WAAW;AAErC,SAASS,wBAAwBA,CAAA,EAAG;EACzC,IAAI,CAACH,eAAe,EAAE;IACpB,MAAM,IAAII,KAAK,CACb;AACN,iDACI,CAAC;EACH;AACF;AAEO,MAAMC,cAGM,GAAAJ,OAAA,CAAAI,cAAA,GAAG,EAAAC,WAAA,GAAAb,WAAW,cAAAa,WAAA,uBAAXA,WAAA,CAAaD,cAAc,KAAIF,wBAAwB;AAEtE,MAAMI,eAGO,GAAAN,OAAA,CAAAM,eAAA,GAAG,EAAAC,YAAA,GAAAf,WAAW,cAAAe,YAAA,uBAAXA,YAAA,CAAaD,eAAe,KAAIJ,wBAAwB;AAExE,MAAMM,gBAGK,GAAAR,OAAA,CAAAQ,gBAAA,GAAG,EAAAC,YAAA,GAAAjB,WAAW,cAAAiB,YAAA,uBAAXA,YAAA,CAAaD,gBAAgB,KAAIN,wBAAwB;AAEvE,MAAMQ,WAIF,GAAAV,OAAA,CAAAU,WAAA,GAAG,EAAAC,YAAA,GAAAnB,WAAW,cAAAmB,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIR,wBAAwB;AAE3D,MAAMU,UAAsC,GAAAZ,OAAA,CAAAY,UAAA,GACjD,EAAAC,YAAA,GAAArB,WAAW,cAAAqB,YAAA,uBAAXA,YAAA,CAAaD,UAAU,KAAIV,wBAAwB;AAE9C,MAAMY,OAAO,GAAAd,OAAA,CAAAc,OAAA,GAAG,EAAAC,YAAA,GAAAvB,WAAW,cAAAuB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAIZ,wBAAwB;AAChE,MAAMc,OAAO,GAAAhB,OAAA,CAAAgB,OAAA,GAAG,EAAAC,YAAA,GAAAzB,WAAW,cAAAyB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAId,wBAAwB;AAChE,MAAMgB,WAA0C,GAAAlB,OAAA,CAAAkB,WAAA,GACrD,EAAAC,YAAA,GAAA3B,WAAW,cAAA2B,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIhB,wBAAwB;AAE/C,MAAMkB,mBAIJ,GAAApB,OAAA,CAAAoB,mBAAA,GAAG,EAAAC,YAAA,GAAA7B,WAAW,cAAA6B,YAAA,uBAAXA,YAAA,CAAaD,mBAAmB,KAAIlB,wBAAwB;AAEjE,MAAMoB,aAAa,GAAOC,KAAc,IAA8B;EAC3E,OACE,CAAC,CAACA,KAAK,KACN9B,WAAW,GACRA,WAAW,CAAC6B,aAAa,CAACC,KAAK,CAAC,GAC/BA,KAAK,CAASA,KAAK,KAAKC,SAAS,CAAC;AAE3C,CAAC;AAACxB,OAAA,CAAAsB,aAAA,GAAAA,aAAA"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { DependencyList } from "react";
|
2
|
-
import type { DerivedValue, FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
|
3
|
-
export declare const HAS_REANIMATED2: boolean;
|
4
|
-
export declare const HAS_REANIMATED3: boolean;
|
5
|
-
export declare function throwOnMissingReanimated(): void;
|
6
|
-
export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
|
7
|
-
export declare const useDerivedValue: <T>(processor: () => T, dependencies?: DependencyList) => DerivedValue<T>;
|
8
|
-
export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
|
9
|
-
export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
|
10
|
-
export declare const stopMapper: (mapperID: number) => void;
|
11
|
-
export declare const runOnJS: any;
|
12
|
-
export declare const runOnUI: any;
|
13
|
-
export declare const makeMutable: <T>(val: T) => SharedValue<T>;
|
14
|
-
export declare const useAnimatedReaction: <T>(prepare: () => T, react: (v: T) => void, dependencies?: DependencyList) => void;
|
15
|
-
export declare const isSharedValue: <T>(value: unknown) => value is SharedValue<T>;
|
@@ -1,37 +0,0 @@
|
|
1
|
-
var _Reanimated, _Reanimated2, _Reanimated3, _Reanimated4, _Reanimated5, _Reanimated6, _Reanimated7, _Reanimated8, _Reanimated9;
|
2
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
3
|
-
|
4
|
-
// This one is needed for the deprecated useSharedValue function
|
5
|
-
// We can remove it once we remove the deprecation
|
6
|
-
|
7
|
-
let Reanimated2;
|
8
|
-
let Reanimated3;
|
9
|
-
let reanimatedVersion;
|
10
|
-
try {
|
11
|
-
Reanimated2 = require("react-native-reanimated");
|
12
|
-
reanimatedVersion = require("react-native-reanimated/package.json").version;
|
13
|
-
if (reanimatedVersion && (reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))) {
|
14
|
-
Reanimated3 = Reanimated2;
|
15
|
-
}
|
16
|
-
} catch (e) {}
|
17
|
-
export const HAS_REANIMATED2 = !!Reanimated2;
|
18
|
-
export const HAS_REANIMATED3 = !!Reanimated3;
|
19
|
-
export function throwOnMissingReanimated() {
|
20
|
-
if (!HAS_REANIMATED2) {
|
21
|
-
throw new Error("Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
|
22
|
-
react-native-skia's integration layer API.");
|
23
|
-
}
|
24
|
-
}
|
25
|
-
export const useSharedValue = ((_Reanimated = Reanimated2) === null || _Reanimated === void 0 ? void 0 : _Reanimated.useSharedValue) || throwOnMissingReanimated;
|
26
|
-
export const useDerivedValue = ((_Reanimated2 = Reanimated2) === null || _Reanimated2 === void 0 ? void 0 : _Reanimated2.useDerivedValue) || throwOnMissingReanimated;
|
27
|
-
export const useFrameCallback = ((_Reanimated3 = Reanimated2) === null || _Reanimated3 === void 0 ? void 0 : _Reanimated3.useFrameCallback) || throwOnMissingReanimated;
|
28
|
-
export const startMapper = ((_Reanimated4 = Reanimated2) === null || _Reanimated4 === void 0 ? void 0 : _Reanimated4.startMapper) || throwOnMissingReanimated;
|
29
|
-
export const stopMapper = ((_Reanimated5 = Reanimated2) === null || _Reanimated5 === void 0 ? void 0 : _Reanimated5.stopMapper) || throwOnMissingReanimated;
|
30
|
-
export const runOnJS = ((_Reanimated6 = Reanimated2) === null || _Reanimated6 === void 0 ? void 0 : _Reanimated6.runOnJS) || throwOnMissingReanimated;
|
31
|
-
export const runOnUI = ((_Reanimated7 = Reanimated2) === null || _Reanimated7 === void 0 ? void 0 : _Reanimated7.runOnUI) || throwOnMissingReanimated;
|
32
|
-
export const makeMutable = ((_Reanimated8 = Reanimated2) === null || _Reanimated8 === void 0 ? void 0 : _Reanimated8.makeMutable) || throwOnMissingReanimated;
|
33
|
-
export const useAnimatedReaction = ((_Reanimated9 = Reanimated2) === null || _Reanimated9 === void 0 ? void 0 : _Reanimated9.useAnimatedReaction) || throwOnMissingReanimated;
|
34
|
-
export const isSharedValue = value => {
|
35
|
-
return !!value && (Reanimated3 ? Reanimated3.isSharedValue(value) : value.value !== undefined);
|
36
|
-
};
|
37
|
-
//# sourceMappingURL=moduleWrapper.js.map
|
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"names":["Reanimated2","Reanimated3","reanimatedVersion","require","version","includes","e","HAS_REANIMATED2","HAS_REANIMATED3","throwOnMissingReanimated","Error","useSharedValue","_Reanimated","useDerivedValue","_Reanimated2","useFrameCallback","_Reanimated3","startMapper","_Reanimated4","stopMapper","_Reanimated5","runOnJS","_Reanimated6","runOnUI","_Reanimated7","makeMutable","_Reanimated8","useAnimatedReaction","_Reanimated9","isSharedValue","value","undefined"],"sources":["moduleWrapper.ts"],"sourcesContent":["/* eslint-disable @typescript-eslint/no-explicit-any */\nimport type { DependencyList } from \"react\";\nimport type {\n DerivedValue,\n FrameCallback,\n FrameInfo,\n SharedValue,\n} from \"react-native-reanimated\";\n\n// This one is needed for the deprecated useSharedValue function\n// We can remove it once we remove the deprecation\n\nlet Reanimated2: any;\n\nlet Reanimated3: any;\nlet reanimatedVersion: string;\n\ntry {\n Reanimated2 = require(\"react-native-reanimated\");\n reanimatedVersion = require(\"react-native-reanimated/package.json\").version;\n if (\n reanimatedVersion &&\n (reanimatedVersion >= \"3.0.0\" || reanimatedVersion.includes(\"3.0.0-\"))\n ) {\n Reanimated3 = Reanimated2;\n }\n} catch (e) {}\n\nexport const HAS_REANIMATED2 = !!Reanimated2;\nexport const HAS_REANIMATED3 = !!Reanimated3;\n\nexport function throwOnMissingReanimated() {\n if (!HAS_REANIMATED2) {\n throw new Error(\n \"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \\\n react-native-skia's integration layer API.\"\n );\n }\n}\n\nexport const useSharedValue: <T>(\n init: T,\n oneWayReadsOnly?: boolean\n) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;\n\nexport const useDerivedValue: <T>(\n processor: () => T,\n dependencies?: DependencyList\n) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;\n\nexport const useFrameCallback: (\n callback: (frameInfo: FrameInfo) => void,\n autostart?: boolean\n) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;\n\nexport const startMapper: (\n worklet: () => void,\n inputs?: unknown[],\n outputs?: unknown[]\n) => number = Reanimated2?.startMapper || throwOnMissingReanimated;\n\nexport const stopMapper: (mapperID: number) => void =\n Reanimated2?.stopMapper || throwOnMissingReanimated;\n\nexport const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;\nexport const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;\nexport const makeMutable: <T>(val: T) => SharedValue<T> =\n Reanimated2?.makeMutable || throwOnMissingReanimated;\n\nexport const useAnimatedReaction: <T>(\n prepare: () => T,\n react: (v: T) => void,\n dependencies?: DependencyList\n) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;\n\nexport const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {\n return (\n !!value &&\n (Reanimated3\n ? Reanimated3.isSharedValue(value)\n : (value as any).value !== undefined)\n );\n};\n"],"mappings":";AAAA;;AASA;AACA;;AAEA,IAAIA,WAAgB;AAEpB,IAAIC,WAAgB;AACpB,IAAIC,iBAAyB;AAE7B,IAAI;EACFF,WAAW,GAAGG,OAAO,CAAC,yBAAyB,CAAC;EAChDD,iBAAiB,GAAGC,OAAO,CAAC,sCAAsC,CAAC,CAACC,OAAO;EAC3E,IACEF,iBAAiB,KAChBA,iBAAiB,IAAI,OAAO,IAAIA,iBAAiB,CAACG,QAAQ,CAAC,QAAQ,CAAC,CAAC,EACtE;IACAJ,WAAW,GAAGD,WAAW;EAC3B;AACF,CAAC,CAAC,OAAOM,CAAC,EAAE,CAAC;AAEb,OAAO,MAAMC,eAAe,GAAG,CAAC,CAACP,WAAW;AAC5C,OAAO,MAAMQ,eAAe,GAAG,CAAC,CAACP,WAAW;AAE5C,OAAO,SAASQ,wBAAwBA,CAAA,EAAG;EACzC,IAAI,CAACF,eAAe,EAAE;IACpB,MAAM,IAAIG,KAAK,CACb;AACN,iDACI,CAAC;EACH;AACF;AAEA,OAAO,MAAMC,cAGM,GAAG,EAAAC,WAAA,GAAAZ,WAAW,cAAAY,WAAA,uBAAXA,WAAA,CAAaD,cAAc,KAAIF,wBAAwB;AAE7E,OAAO,MAAMI,eAGO,GAAG,EAAAC,YAAA,GAAAd,WAAW,cAAAc,YAAA,uBAAXA,YAAA,CAAaD,eAAe,KAAIJ,wBAAwB;AAE/E,OAAO,MAAMM,gBAGK,GAAG,EAAAC,YAAA,GAAAhB,WAAW,cAAAgB,YAAA,uBAAXA,YAAA,CAAaD,gBAAgB,KAAIN,wBAAwB;AAE9E,OAAO,MAAMQ,WAIF,GAAG,EAAAC,YAAA,GAAAlB,WAAW,cAAAkB,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIR,wBAAwB;AAElE,OAAO,MAAMU,UAAsC,GACjD,EAAAC,YAAA,GAAApB,WAAW,cAAAoB,YAAA,uBAAXA,YAAA,CAAaD,UAAU,KAAIV,wBAAwB;AAErD,OAAO,MAAMY,OAAO,GAAG,EAAAC,YAAA,GAAAtB,WAAW,cAAAsB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAIZ,wBAAwB;AACvE,OAAO,MAAMc,OAAO,GAAG,EAAAC,YAAA,GAAAxB,WAAW,cAAAwB,YAAA,uBAAXA,YAAA,CAAaD,OAAO,KAAId,wBAAwB;AACvE,OAAO,MAAMgB,WAA0C,GACrD,EAAAC,YAAA,GAAA1B,WAAW,cAAA0B,YAAA,uBAAXA,YAAA,CAAaD,WAAW,KAAIhB,wBAAwB;AAEtD,OAAO,MAAMkB,mBAIJ,GAAG,EAAAC,YAAA,GAAA5B,WAAW,cAAA4B,YAAA,uBAAXA,YAAA,CAAaD,mBAAmB,KAAIlB,wBAAwB;AAExE,OAAO,MAAMoB,aAAa,GAAOC,KAAc,IAA8B;EAC3E,OACE,CAAC,CAACA,KAAK,KACN7B,WAAW,GACRA,WAAW,CAAC4B,aAAa,CAACC,KAAK,CAAC,GAC/BA,KAAK,CAASA,KAAK,KAAKC,SAAS,CAAC;AAE3C,CAAC"}
|
@@ -1,15 +0,0 @@
|
|
1
|
-
import type { DependencyList } from "react";
|
2
|
-
import type { DerivedValue, FrameCallback, FrameInfo, SharedValue } from "react-native-reanimated";
|
3
|
-
export declare const HAS_REANIMATED2: boolean;
|
4
|
-
export declare const HAS_REANIMATED3: boolean;
|
5
|
-
export declare function throwOnMissingReanimated(): void;
|
6
|
-
export declare const useSharedValue: <T>(init: T, oneWayReadsOnly?: boolean) => SharedValue<T>;
|
7
|
-
export declare const useDerivedValue: <T>(processor: () => T, dependencies?: DependencyList) => DerivedValue<T>;
|
8
|
-
export declare const useFrameCallback: (callback: (frameInfo: FrameInfo) => void, autostart?: boolean) => FrameCallback;
|
9
|
-
export declare const startMapper: (worklet: () => void, inputs?: unknown[], outputs?: unknown[]) => number;
|
10
|
-
export declare const stopMapper: (mapperID: number) => void;
|
11
|
-
export declare const runOnJS: any;
|
12
|
-
export declare const runOnUI: any;
|
13
|
-
export declare const makeMutable: <T>(val: T) => SharedValue<T>;
|
14
|
-
export declare const useAnimatedReaction: <T>(prepare: () => T, react: (v: T) => void, dependencies?: DependencyList) => void;
|
15
|
-
export declare const isSharedValue: <T>(value: unknown) => value is SharedValue<T>;
|
@@ -1,83 +0,0 @@
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
2
|
-
import type { DependencyList } from "react";
|
3
|
-
import type {
|
4
|
-
DerivedValue,
|
5
|
-
FrameCallback,
|
6
|
-
FrameInfo,
|
7
|
-
SharedValue,
|
8
|
-
} from "react-native-reanimated";
|
9
|
-
|
10
|
-
// This one is needed for the deprecated useSharedValue function
|
11
|
-
// We can remove it once we remove the deprecation
|
12
|
-
|
13
|
-
let Reanimated2: any;
|
14
|
-
|
15
|
-
let Reanimated3: any;
|
16
|
-
let reanimatedVersion: string;
|
17
|
-
|
18
|
-
try {
|
19
|
-
Reanimated2 = require("react-native-reanimated");
|
20
|
-
reanimatedVersion = require("react-native-reanimated/package.json").version;
|
21
|
-
if (
|
22
|
-
reanimatedVersion &&
|
23
|
-
(reanimatedVersion >= "3.0.0" || reanimatedVersion.includes("3.0.0-"))
|
24
|
-
) {
|
25
|
-
Reanimated3 = Reanimated2;
|
26
|
-
}
|
27
|
-
} catch (e) {}
|
28
|
-
|
29
|
-
export const HAS_REANIMATED2 = !!Reanimated2;
|
30
|
-
export const HAS_REANIMATED3 = !!Reanimated3;
|
31
|
-
|
32
|
-
export function throwOnMissingReanimated() {
|
33
|
-
if (!HAS_REANIMATED2) {
|
34
|
-
throw new Error(
|
35
|
-
"Reanimated was not found, make sure react-native-reanimated package is installed if you want to use \
|
36
|
-
react-native-skia's integration layer API."
|
37
|
-
);
|
38
|
-
}
|
39
|
-
}
|
40
|
-
|
41
|
-
export const useSharedValue: <T>(
|
42
|
-
init: T,
|
43
|
-
oneWayReadsOnly?: boolean
|
44
|
-
) => SharedValue<T> = Reanimated2?.useSharedValue || throwOnMissingReanimated;
|
45
|
-
|
46
|
-
export const useDerivedValue: <T>(
|
47
|
-
processor: () => T,
|
48
|
-
dependencies?: DependencyList
|
49
|
-
) => DerivedValue<T> = Reanimated2?.useDerivedValue || throwOnMissingReanimated;
|
50
|
-
|
51
|
-
export const useFrameCallback: (
|
52
|
-
callback: (frameInfo: FrameInfo) => void,
|
53
|
-
autostart?: boolean
|
54
|
-
) => FrameCallback = Reanimated2?.useFrameCallback || throwOnMissingReanimated;
|
55
|
-
|
56
|
-
export const startMapper: (
|
57
|
-
worklet: () => void,
|
58
|
-
inputs?: unknown[],
|
59
|
-
outputs?: unknown[]
|
60
|
-
) => number = Reanimated2?.startMapper || throwOnMissingReanimated;
|
61
|
-
|
62
|
-
export const stopMapper: (mapperID: number) => void =
|
63
|
-
Reanimated2?.stopMapper || throwOnMissingReanimated;
|
64
|
-
|
65
|
-
export const runOnJS = Reanimated2?.runOnJS || throwOnMissingReanimated;
|
66
|
-
export const runOnUI = Reanimated2?.runOnUI || throwOnMissingReanimated;
|
67
|
-
export const makeMutable: <T>(val: T) => SharedValue<T> =
|
68
|
-
Reanimated2?.makeMutable || throwOnMissingReanimated;
|
69
|
-
|
70
|
-
export const useAnimatedReaction: <T>(
|
71
|
-
prepare: () => T,
|
72
|
-
react: (v: T) => void,
|
73
|
-
dependencies?: DependencyList
|
74
|
-
) => void = Reanimated2?.useAnimatedReaction || throwOnMissingReanimated;
|
75
|
-
|
76
|
-
export const isSharedValue = <T>(value: unknown): value is SharedValue<T> => {
|
77
|
-
return (
|
78
|
-
!!value &&
|
79
|
-
(Reanimated3
|
80
|
-
? Reanimated3.isSharedValue(value)
|
81
|
-
: (value as any).value !== undefined)
|
82
|
-
);
|
83
|
-
};
|