|
@@ -3,7 +3,7 @@ import React, { Component } from "react";
|
3
|
3
|
import { View, NativeModules, Platform, findNodeHandle } from "react-native";
|
4
|
4
|
const { RNViewShot } = NativeModules;
|
5
|
5
|
|
6
|
|
-import type { Element, ElementRef } from 'react';
|
|
6
|
+import type { Element, ElementRef, ElementType, Ref } from 'react';
|
7
|
7
|
import type { ViewStyleProp } from 'StyleSheet';
|
8
|
8
|
import type { LayoutEvent } from 'CoreEventTypes';
|
9
|
9
|
|
|
@@ -88,10 +88,13 @@ function validateOptions(
|
88
|
88
|
return { options, errors };
|
89
|
89
|
}
|
90
|
90
|
|
91
|
|
-export function captureRef(
|
92
|
|
- view: number | ?View,
|
|
91
|
+export function captureRef<T: ElementType>(
|
|
92
|
+ view: number | ?View | Ref<T>,
|
93
|
93
|
optionsObject?: Object
|
94
|
94
|
): Promise<string> {
|
|
95
|
+ if (view && typeof view === "object" && "current" in view && view.current) { // React.RefObject
|
|
96
|
+ view = view.current;
|
|
97
|
+ }
|
95
|
98
|
if (typeof view !== "number") {
|
96
|
99
|
const node = findNodeHandle(view);
|
97
|
100
|
if (!node)
|