Skip to content

Commit 1b8d205

Browse files
committed
use React namespace
1 parent 5dbb9e4 commit 1b8d205

File tree

1 file changed

+19
-23
lines changed

1 file changed

+19
-23
lines changed

packages/react-native-renderer/src/ReactNativeTypes.js

Lines changed: 19 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -10,22 +10,18 @@
1010
*/
1111

1212
import type {
13-
Component as ReactComponent,
14-
ElementRef,
15-
ElementType,
16-
MixedElement,
17-
} from 'react';
18-
import type {
19-
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
20-
MeasureOnSuccessCallback,
2113
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
2214
HostInstance as PublicInstance,
2315
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
16+
MeasureOnSuccessCallback,
17+
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
2418
PublicRootInstance,
2519
// $FlowFixMe[nonstrict-import] TODO(@rubennorte)
2620
PublicTextInstance,
2721
} from 'react-native';
2822

23+
import * as React from 'react';
24+
2925
export type AttributeType<T, V> =
3026
| true
3127
| $ReadOnly<{
@@ -96,8 +92,8 @@ type InspectorDataProps = $ReadOnly<{
9692
}>;
9793

9894
type InspectorDataGetter = (
99-
<TElementType: ElementType>(
100-
componentOrHandle: ElementRef<TElementType> | number,
95+
<TElementType: React.ElementType>(
96+
componentOrHandle: React.ElementRef<TElementType> | number,
10197
) => ?number,
10298
) => $ReadOnly<{
10399
measure: (callback: MeasureOnSuccessCallback) => void,
@@ -140,7 +136,7 @@ export type RenderRootOptions = {
140136
+componentStack?: ?string,
141137
// $FlowFixMe[unclear-type] unknown props and state.
142138
// $FlowFixMe[value-as-type] Component in react repo is any-typed, but it will be well typed externally.
143-
+errorBoundary?: ?ReactComponent<any, any>,
139+
+errorBoundary?: ?React.Component<any, any>,
144140
},
145141
) => void,
146142
onRecoverableError?: (
@@ -154,11 +150,11 @@ export type RenderRootOptions = {
154150
* Provide minimal Flow typing for the high-level RN API and call it a day.
155151
*/
156152
export type ReactNativeType = {
157-
findHostInstance_DEPRECATED<TElementType: ElementType>(
158-
componentOrHandle: ?(ElementRef<TElementType> | number),
153+
findHostInstance_DEPRECATED<TElementType: React.ElementType>(
154+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
159155
): ?PublicInstance,
160-
findNodeHandle<TElementType: ElementType>(
161-
componentOrHandle: ?(ElementRef<TElementType> | number),
156+
findNodeHandle<TElementType: React.ElementType>(
157+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
162158
): ?number,
163159
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
164160
dispatchCommand(
@@ -168,11 +164,11 @@ export type ReactNativeType = {
168164
): void,
169165
sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
170166
render(
171-
element: MixedElement,
167+
element: React.MixedElement,
172168
containerTag: number,
173169
callback: ?() => void,
174170
options: ?RenderRootOptions,
175-
): ?ElementRef<ElementType>,
171+
): ?React.ElementRef<React.ElementType>,
176172
unmountComponentAtNode(containerTag: number): void,
177173
unmountComponentAtNodeAndRemoveContainer(containerTag: number): void,
178174
+unstable_batchedUpdates: <T>(fn: (T) => void, bookkeeping: T) => void,
@@ -183,11 +179,11 @@ export opaque type Node = mixed;
183179
export opaque type InternalInstanceHandle = mixed;
184180

185181
export type ReactFabricType = {
186-
findHostInstance_DEPRECATED<TElementType: ElementType>(
187-
componentOrHandle: ?(ElementRef<TElementType> | number),
182+
findHostInstance_DEPRECATED<TElementType: React.ElementType>(
183+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
188184
): ?PublicInstance,
189-
findNodeHandle<TElementType: ElementType>(
190-
componentOrHandle: ?(ElementRef<TElementType> | number),
185+
findNodeHandle<TElementType: React.ElementType>(
186+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
191187
): ?number,
192188
dispatchCommand(
193189
handle: PublicInstance,
@@ -197,12 +193,12 @@ export type ReactFabricType = {
197193
isChildPublicInstance(parent: PublicInstance, child: PublicInstance): boolean,
198194
sendAccessibilityEvent(handle: PublicInstance, eventType: string): void,
199195
render(
200-
element: MixedElement,
196+
element: React.MixedElement,
201197
containerTag: number,
202198
callback: ?() => void,
203199
concurrentRoot: ?boolean,
204200
options: ?RenderRootOptions,
205-
): ?ElementRef<ElementType>,
201+
): ?React.ElementRef<React.ElementType>,
206202
unmountComponentAtNode(containerTag: number): void,
207203
getNodeFromInternalInstanceHandle(
208204
internalInstanceHandle: InternalInstanceHandle,

0 commit comments

Comments
 (0)