Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ function checkCompatibleProps(props: ViewShotProperties): void {
* method is attached to that node for the imperative `ref.current.capture()`
* usage.
*/
export type ViewShotRef = View & {
export type ViewShotRef = React.ComponentRef<typeof View> & {
capture: () => Promise<string>;
};

Expand All @@ -328,7 +328,7 @@ const ViewShotComponent = forwardRef<ViewShotRef, ViewShotProperties>(
style,
} = props;

const rootRef = useRef<View | null>(null);
const rootRef = useRef<React.ComponentRef<typeof View> | null>(null);
const rafRef = useRef<number | null>(null);
const lastCapturedURIRef = useRef<string | null>(null);
const resolveFirstLayoutRef = useRef<((layout: unknown) => void) | null>(
Expand Down Expand Up @@ -378,7 +378,7 @@ const ViewShotComponent = forwardRef<ViewShotRef, ViewShotProperties>(
);

const setRootRef = useCallback(
(node: View | null): void => {
(node: React.ComponentRef<typeof View> | null): void => {
rootRef.current = node;
if (node) (node as ViewShotRef).capture = capture;
if (typeof ref === "function") {
Expand Down
4 changes: 2 additions & 2 deletions src/specs/NativeRNViewShot.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import type {TurboModule} from "react-native";
import {TurboModuleRegistry, NativeModules} from "react-native";
import {WithDefault} from "react-native/Libraries/Types/CodegenTypes";
import type {CodegenTypes} from "react-native";

// Options stay `Object` (codegen → ReadableMap / NSDictionary).
// Narrowing here would force a coordinated change to both native module
// signatures.
export interface Spec extends TurboModule {
releaseCapture: (uri: string) => void;
captureRef: (
target: WithDefault<number, -1>,
target: CodegenTypes.WithDefault<number, -1>,
withOptions: Object,
) => Promise<string>;
captureScreen: (options: Object) => Promise<string>;
Expand Down