Import React namespace instead of specific types (#50749)

Summary:
Pull Request resolved: https://github.com/facebook/react-native/pull/50749

Changelog: [Internal]

Reviewed By: huntie

Differential Revision: D73088912

fbshipit-source-id: 23e4d530fc3b7fb2a0611ba1721474671ab0b9fd
This commit is contained in:
Jakub Piasecki
2025-04-16 03:58:58 -07:00
committed by Facebook GitHub Bot
parent e05c0e67d0
commit e0a506fac3
2 changed files with 12 additions and 9 deletions
@@ -13,7 +13,6 @@ import type {
InternalInstanceHandle,
Node,
} from '../Renderer/shims/ReactNativeTypes';
import type {ElementRef, ElementType} from 'react';
import {
onCaughtError,
@@ -21,6 +20,8 @@ import {
onUncaughtError,
} from '../../src/private/renderer/errorhandling/ErrorHandlers';
import {type RootTag} from './RootTag';
import * as React from 'react';
export function renderElement({
element,
rootTag,
@@ -58,9 +59,9 @@ export function renderElement({
}
}
export function findHostInstance_DEPRECATED<TElementType: ElementType>(
export function findHostInstance_DEPRECATED<TElementType: React.ElementType>(
// $FlowFixMe[incompatible-call]
componentOrHandle: ?(ElementRef<TElementType> | number),
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?HostInstance {
return require('../Renderer/shims/ReactNative').default.findHostInstance_DEPRECATED(
// $FlowFixMe[incompatible-call]
@@ -68,9 +69,9 @@ export function findHostInstance_DEPRECATED<TElementType: ElementType>(
);
}
export function findNodeHandle<TElementType: ElementType>(
export function findNodeHandle<TElementType: React.ElementType>(
// $FlowFixMe[incompatible-call]
componentOrHandle: ?(ElementRef<TElementType> | number),
componentOrHandle: ?(React.ElementRef<TElementType> | number),
): ?number {
return require('../Renderer/shims/ReactNative').default.findNodeHandle(
// $FlowFixMe[incompatible-call]
@@ -6749,11 +6749,13 @@ exports[`public API should not change unintentionally Libraries/ReactNative/Rend
useFabric: boolean,
useConcurrentRoot: boolean,
}): void;
declare export function findHostInstance_DEPRECATED<TElementType: ElementType>(
componentOrHandle: ?(ElementRef<TElementType> | number)
declare export function findHostInstance_DEPRECATED<
TElementType: React.ElementType,
>(
componentOrHandle: ?(React.ElementRef<TElementType> | number)
): ?HostInstance;
declare export function findNodeHandle<TElementType: ElementType>(
componentOrHandle: ?(ElementRef<TElementType> | number)
declare export function findNodeHandle<TElementType: React.ElementType>(
componentOrHandle: ?(React.ElementRef<TElementType> | number)
): ?number;
declare export function dispatchCommand(
handle: HostInstance,