Skip to content

Commit e0a506f

Browse files
j-piaseckifacebook-github-bot
authored andcommitted
Import React namespace instead of specific types (facebook#50749)
Summary: Pull Request resolved: facebook#50749 Changelog: [Internal] Reviewed By: huntie Differential Revision: D73088912 fbshipit-source-id: 23e4d530fc3b7fb2a0611ba1721474671ab0b9fd
1 parent e05c0e6 commit e0a506f

File tree

2 files changed

+12
-9
lines changed

2 files changed

+12
-9
lines changed

packages/react-native/Libraries/ReactNative/RendererImplementation.js

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,15 @@ import type {
1313
InternalInstanceHandle,
1414
Node,
1515
} from '../Renderer/shims/ReactNativeTypes';
16-
import type {ElementRef, ElementType} from 'react';
1716

1817
import {
1918
onCaughtError,
2019
onRecoverableError,
2120
onUncaughtError,
2221
} from '../../src/private/renderer/errorhandling/ErrorHandlers';
2322
import {type RootTag} from './RootTag';
23+
import * as React from 'react';
24+
2425
export function renderElement({
2526
element,
2627
rootTag,
@@ -58,19 +59,19 @@ export function renderElement({
5859
}
5960
}
6061

61-
export function findHostInstance_DEPRECATED<TElementType: ElementType>(
62+
export function findHostInstance_DEPRECATED<TElementType: React.ElementType>(
6263
// $FlowFixMe[incompatible-call]
63-
componentOrHandle: ?(ElementRef<TElementType> | number),
64+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
6465
): ?HostInstance {
6566
return require('../Renderer/shims/ReactNative').default.findHostInstance_DEPRECATED(
6667
// $FlowFixMe[incompatible-call]
6768
componentOrHandle,
6869
);
6970
}
7071

71-
export function findNodeHandle<TElementType: ElementType>(
72+
export function findNodeHandle<TElementType: React.ElementType>(
7273
// $FlowFixMe[incompatible-call]
73-
componentOrHandle: ?(ElementRef<TElementType> | number),
74+
componentOrHandle: ?(React.ElementRef<TElementType> | number),
7475
): ?number {
7576
return require('../Renderer/shims/ReactNative').default.findNodeHandle(
7677
// $FlowFixMe[incompatible-call]

packages/react-native/Libraries/__tests__/__snapshots__/public-api-test.js.snap

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6749,11 +6749,13 @@ exports[`public API should not change unintentionally Libraries/ReactNative/Rend
67496749
useFabric: boolean,
67506750
useConcurrentRoot: boolean,
67516751
}): void;
6752-
declare export function findHostInstance_DEPRECATED<TElementType: ElementType>(
6753-
componentOrHandle: ?(ElementRef<TElementType> | number)
6752+
declare export function findHostInstance_DEPRECATED<
6753+
TElementType: React.ElementType,
6754+
>(
6755+
componentOrHandle: ?(React.ElementRef<TElementType> | number)
67546756
): ?HostInstance;
6755-
declare export function findNodeHandle<TElementType: ElementType>(
6756-
componentOrHandle: ?(ElementRef<TElementType> | number)
6757+
declare export function findNodeHandle<TElementType: React.ElementType>(
6758+
componentOrHandle: ?(React.ElementRef<TElementType> | number)
67576759
): ?number;
67586760
declare export function dispatchCommand(
67596761
handle: HostInstance,

0 commit comments

Comments
 (0)