diff --git a/types/react-native/index.d.ts b/types/react-native/index.d.ts
index 3742bf5003..083c646be7 100644
--- a/types/react-native/index.d.ts
+++ b/types/react-native/index.d.ts
@@ -8418,7 +8418,7 @@ export function requireNativeComponent
(
extraConfig?: {nativeOnly?: any}
): React.ComponentClass
;
-export function findNodeHandle(componentOrHandle: null | number | React.Component): null | number;
+export function findNodeHandle(componentOrHandle: null | number | React.Component | React.ComponentClass): null | number;
export function processColor(color: any): number;
diff --git a/types/react-native/test/index.tsx b/types/react-native/test/index.tsx
index 575693211e..45a5b510e9 100644
--- a/types/react-native/test/index.tsx
+++ b/types/react-native/test/index.tsx
@@ -25,6 +25,7 @@ import {
View,
ViewStyle,
ViewPagerAndroid,
+ findNodeHandle
} from 'react-native';
function testDimensions() {
@@ -88,20 +89,43 @@ const stylesAlt = StyleSheet.create(
}
)
+class CustomView extends React.Component<{}, {}> {
+
+ render() {
+ return (
+ Custom View
+ );
+ }
+
+}
class Welcome extends React.Component {
refs: {
- [key: string]: any
- rootView: View
+ [key: string]: any
+ rootView: View
+ customView: CustomView
}
testNativeMethods() {
- // this.setNativeProps({});
+ // this.setNativeProps({});
- const { rootView } = this.refs;
+ const { rootView } = this.refs;
+
+ rootView.measure((x: number, y: number, width: number, height: number) => {
+ });
+
+ }
+
+ testFindNodeHandle() {
+
+ const { rootView, customView } = this.refs;
+
+ let nativeComponentHandle = findNodeHandle(rootView);
+
+ let customComponentHandle = findNodeHandle(customView);
+
+ let fromHandle = findNodeHandle(customComponentHandle);
- rootView.measure((x: number, y: number, width: number, height: number) => {
- });
}
render() {
@@ -117,6 +141,7 @@ class Welcome extends React.Component {
Press Cmd+R to reload,{'\n'}
Cmd+D or shake for dev menu
+
)
}