4
4
* This source code is licensed under the MIT license found in the
5
5
* LICENSE file in the root directory of this source tree.
6
6
*
7
+ * @format
7
8
* @flow
8
9
*/
9
10
11
+ import * as React from 'react' ;
12
+
10
13
export type MeasureOnSuccessCallback = (
11
14
x : number ,
12
15
y : number ,
@@ -51,6 +54,22 @@ export type ReactNativeBaseComponentViewConfig = {
51
54
52
55
export type ViewConfigGetter = ( ) => ReactNativeBaseComponentViewConfig ;
53
56
57
+ /**
58
+ * Class only exists for its Flow type.
59
+ */
60
+ class ReactNativeComponent < Props > extends React.Component< Props > {
61
+ blur ( ) : void { }
62
+ focus ( ) : void { }
63
+ measure ( callback : MeasureOnSuccessCallback ) : void { }
64
+ measureInWindow ( callback : MeasureInWindowOnSuccessCallback ) : void { }
65
+ measureLayout (
66
+ relativeToNativeNode : number ,
67
+ onSuccess : MeasureLayoutOnSuccessCallback ,
68
+ onFail ?: ( ) => void ,
69
+ ) : void { }
70
+ setNativeProps ( nativeProps : Object ) : void { }
71
+ }
72
+
54
73
/**
55
74
* This type keeps ReactNativeFiberHostComponent and NativeMethodsMixin in sync.
56
75
* It can also provide types for ReactNative applications that use NMM or refs.
@@ -86,7 +105,7 @@ type SecretInternalsFabricType = {
86
105
* Provide minimal Flow typing for the high-level RN API and call it a day.
87
106
*/
88
107
export type ReactNativeType = {
89
- NativeComponent : any ,
108
+ NativeComponent : typeof ReactNativeComponent ,
90
109
findNodeHandle ( componentOrHandle : any ) : ?number ,
91
110
render (
92
111
element : React$Element < any > ,
@@ -101,7 +120,7 @@ export type ReactNativeType = {
101
120
} ;
102
121
103
122
export type ReactFabricType = {
104
- NativeComponent : any ,
123
+ NativeComponent : typeof ReactNativeComponent ,
105
124
findNodeHandle ( componentOrHandle : any ) : ?number ,
106
125
render (
107
126
element : React$Element < any > ,
0 commit comments