Skip to content

Commit 00a06ca

Browse files
authored
chore(🔥): remove usage of the deprecated forwardRef (#3586)
1 parent b1aff27 commit 00a06ca

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

‎packages/skia/src/views/SkiaPictureView.web.tsx‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ import React, {
44
useEffect,
55
useCallback,
66
useImperativeHandle,
7-
forwardRef,
87
} from "react";
98
import type { LayoutChangeEvent } from "react-native";
109

@@ -239,10 +238,12 @@ export interface SkiaPictureViewHandle {
239238
): void;
240239
}
241240

242-
export const SkiaPictureView = forwardRef<
243-
SkiaPictureViewHandle,
244-
SkiaPictureViewNativeProps
245-
>((props, ref) => {
241+
export interface SkiaPictureViewProps extends SkiaPictureViewNativeProps {
242+
ref?: React.Ref<SkiaPictureViewHandle>;
243+
}
244+
245+
export const SkiaPictureView = (props: SkiaPictureViewProps) => {
246+
const { ref } = props;
246247
const canvasRef = useRef<HTMLCanvasElement | null>(null);
247248
const renderer = useRef<Renderer | null>(null);
248249
const redrawRequestsRef = useRef(0);
@@ -415,10 +416,10 @@ export const SkiaPictureView = forwardRef<
415416
}
416417
}, [picture, redraw]);
417418

418-
const { debug = false, ...viewProps } = props;
419+
const { debug = false, ref: _ref, ...viewProps } = props;
419420
return (
420421
<Platform.View {...viewProps} onLayout={onLayoutEvent}>
421422
<canvas ref={canvasRef} style={{ display: "flex", flex: 1 }} />
422423
</Platform.View>
423424
);
424-
});
425+
};

0 commit comments

Comments
 (0)