mirror of
https://github.com/facebook/react.git
synced 2025-11-01 09:12:30 +00:00
Add ReactNativeTypes for root options
This commit is contained in:
+2
-19
@@ -10,6 +10,7 @@
|
||||
import type {ReactPortal, ReactNodeList} from 'shared/ReactTypes';
|
||||
import type {ElementRef, Element, ElementType} from 'react';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
|
||||
import type {RenderRootOptions} from './ReactNativeTypes';
|
||||
|
||||
import './ReactFabricInjection';
|
||||
|
||||
@@ -101,30 +102,12 @@ function nativeOnCaughtError(
|
||||
defaultOnCaughtError(error, errorInfo);
|
||||
}
|
||||
|
||||
type NativeRenderOptions = {
|
||||
onUncaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
onCaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {
|
||||
+componentStack?: ?string,
|
||||
+errorBoundary?: ?React$Component<any, any>,
|
||||
},
|
||||
) => void,
|
||||
onRecoverableError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
};
|
||||
|
||||
function render(
|
||||
element: Element<ElementType>,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
concurrentRoot: ?boolean,
|
||||
options?: NativeRenderOptions,
|
||||
options: ?RenderRootOptions,
|
||||
): ?ElementRef<ElementType> {
|
||||
if (disableLegacyMode && !concurrentRoot) {
|
||||
throw new Error('render: Unsupported Legacy Mode API.');
|
||||
|
||||
+2
-19
@@ -10,6 +10,7 @@
|
||||
import type {ReactPortal, ReactNodeList} from 'shared/ReactTypes';
|
||||
import type {ElementRef, Element, ElementType} from 'react';
|
||||
import type {FiberRoot} from 'react-reconciler/src/ReactInternalTypes';
|
||||
import type {RenderRootOptions} from './ReactNativeTypes';
|
||||
|
||||
import './ReactNativeInjection';
|
||||
|
||||
@@ -106,29 +107,11 @@ function nativeOnCaughtError(
|
||||
defaultOnCaughtError(error, errorInfo);
|
||||
}
|
||||
|
||||
type NativeRenderOptions = {
|
||||
onUncaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
onCaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {
|
||||
+componentStack?: ?string,
|
||||
+errorBoundary?: ?React$Component<any, any>,
|
||||
},
|
||||
) => void,
|
||||
onRecoverableError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
};
|
||||
|
||||
function render(
|
||||
element: Element<ElementType>,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
options?: NativeRenderOptions,
|
||||
options: ?RenderRootOptions,
|
||||
): ?ElementRef<ElementType> {
|
||||
if (disableLegacyMode) {
|
||||
throw new Error('render: Unsupported Legacy Mode API.');
|
||||
|
||||
+27
-1
@@ -4,8 +4,13 @@
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
* @noformat
|
||||
* @flow strict
|
||||
* @nolint
|
||||
* @generated SignedSource<<f33ee88cc50bb00a16d281dce9952e21>>
|
||||
* @generated SignedSource<<dda07b9b2e2bd7345cce0ff966d9fc46>>
|
||||
*
|
||||
* This file was sync'd from the facebook/react repository.
|
||||
*/
|
||||
|
||||
import type {ElementRef, ElementType, Element, AbstractComponent} from 'react';
|
||||
@@ -174,6 +179,25 @@ export type TouchedViewDataAtPoint = $ReadOnly<{
|
||||
...InspectorData,
|
||||
}>;
|
||||
|
||||
export type RenderRootOptions = {
|
||||
onUncaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
onCaughtError?: (
|
||||
error: mixed,
|
||||
errorInfo: {
|
||||
+componentStack?: ?string,
|
||||
// $FlowFixMe[unclear-type] unknown props and state.
|
||||
+errorBoundary?: ?React$Component<any, any>,
|
||||
},
|
||||
) => void,
|
||||
onRecoverableError?: (
|
||||
error: mixed,
|
||||
errorInfo: {+componentStack?: ?string},
|
||||
) => void,
|
||||
};
|
||||
|
||||
/**
|
||||
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
|
||||
* Provide minimal Flow typing for the high-level RN API and call it a day.
|
||||
@@ -202,6 +226,7 @@ export type ReactNativeType = {
|
||||
element: Element<ElementType>,
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
options: ?RenderRootOptions,
|
||||
): ?ElementRef<ElementType>,
|
||||
unmountComponentAtNode(containerTag: number): void,
|
||||
unmountComponentAtNodeAndRemoveContainer(containerTag: number): void,
|
||||
@@ -237,6 +262,7 @@ export type ReactFabricType = {
|
||||
containerTag: number,
|
||||
callback: ?() => void,
|
||||
concurrentRoot: ?boolean,
|
||||
options: ?RenderRootOptions,
|
||||
): ?ElementRef<ElementType>,
|
||||
unmountComponentAtNode(containerTag: number): void,
|
||||
getNodeFromInternalInstanceHandle(
|
||||
|
||||
Reference in New Issue
Block a user