From 2015abd7f5fb038d53bbc658469bccc6c99b1c47 Mon Sep 17 00:00:00 2001 From: William Candillon Date: Fri, 14 Jun 2024 11:01:10 +0200 Subject: [PATCH] =?UTF-8?q?fix(=F0=9F=90=8E):=20Fix=20regression=20with=20?= =?UTF-8?q?Reanimated?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../external/reanimated/useAnimatedImageValue.ts | 2 +- package/src/external/reanimated/useVideoLoading.ts | 13 +++++-------- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/package/src/external/reanimated/useAnimatedImageValue.ts b/package/src/external/reanimated/useAnimatedImageValue.ts index f804d8bf6a..b525d97fab 100644 --- a/package/src/external/reanimated/useAnimatedImageValue.ts +++ b/package/src/external/reanimated/useAnimatedImageValue.ts @@ -1,5 +1,5 @@ import { useEffect } from "react"; -import { type FrameInfo, type SharedValue } from "react-native-reanimated"; +import type { FrameInfo, SharedValue } from "react-native-reanimated"; import { useAnimatedImage } from "../../skia/core/AnimatedImage"; import type { DataSourceParam, SkImage } from "../../skia/types"; diff --git a/package/src/external/reanimated/useVideoLoading.ts b/package/src/external/reanimated/useVideoLoading.ts index 7049956ac1..20e0daae48 100644 --- a/package/src/external/reanimated/useVideoLoading.ts +++ b/package/src/external/reanimated/useVideoLoading.ts @@ -1,14 +1,11 @@ import { useEffect, useState } from "react"; -import { - createWorkletRuntime, - runOnJS, - runOnRuntime, -} from "react-native-reanimated"; import type { Video } from "../../skia/types"; import { Skia } from "../../skia"; -const runtime = createWorkletRuntime("video-metadata-runtime"); +import Rea from "./ReanimatedProxy"; + +const runtime = Rea.createWorkletRuntime("video-metadata-runtime"); type VideoSource = string | null; @@ -17,11 +14,11 @@ export const useVideoLoading = (source: VideoSource) => { const cb = (src: string) => { "worklet"; const vid = Skia.Video(src) as Video; - runOnJS(setVideo)(vid); + Rea.runOnJS(setVideo)(vid); }; useEffect(() => { if (source) { - runOnRuntime(runtime, cb)(source); + Rea.runOnRuntime(runtime, cb)(source); } }, [source]); return video;