Skip to content

Commit

Permalink
fix(🐎): Fix regression with Reanimated (#2482)
Browse files Browse the repository at this point in the history
  • Loading branch information
wcandillon authored Jun 14, 2024
1 parent 391fb9a commit cf226be
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package/src/external/reanimated/useAnimatedImageValue.ts
Original file line number Diff line number Diff line change
@@ -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";
Expand Down
13 changes: 5 additions & 8 deletions package/src/external/reanimated/useVideoLoading.ts
Original file line number Diff line number Diff line change
@@ -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;

Expand All @@ -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;
Expand Down

0 comments on commit cf226be

Please sign in to comment.