Update ReactNativeTypes for root options (part 2) (#28857)
Forgot to push a change before mergin https://github.com/facebook/react/pull/28850
Ricky committed
Apr 17, 2024 at 14:56 UTC
b5e5ce8e0a899345dab1ce71c74bc1d1c28c6a0d
1 file changed
+20
-18
packages/react-native-renderer/src/ReactNativeTypes.js
+20
-18
@@ -174,6 +174,25 @@ export type TouchedViewDataAtPoint = $ReadOnly<{
174
...InspectorData,
175
}>;
176
177
+export type RenderRootOptions = {
178
+ onUncaughtError?: (
179
+ error: mixed,
180
+ errorInfo: {+componentStack?: ?string},
181
+ ) => void,
182
+ onCaughtError?: (
183
+ error: mixed,
184
+ errorInfo: {
185
+ +componentStack?: ?string,
186
+ // $FlowFixMe[unclear-type] unknown props and state.
187
+ +errorBoundary?: ?React$Component<any, any>,
188
+ },
189
+ ) => void,
190
+ onRecoverableError?: (
191
+ error: mixed,
192
+ errorInfo: {+componentStack?: ?string},
193
+ ) => void,
194
+};
195
+
196
/**
197
* Flat ReactNative renderer bundles are too big for Flow to parse efficiently.
198
* Provide minimal Flow typing for the high-level RN API and call it a day.
@@ -202,6 +221,7 @@ export type ReactNativeType = {
221
element: Element<ElementType>,
222
containerTag: number,
223
callback: ?() => void,
224
+ options: ?RenderRootOptions,
225
): ?ElementRef<ElementType>,
226
unmountComponentAtNode(containerTag: number): void,
227
unmountComponentAtNodeAndRemoveContainer(containerTag: number): void,
@@ -215,24 +235,6 @@ export opaque type InternalInstanceHandle = mixed;
235
type PublicInstance = mixed;
236
type PublicTextInstance = mixed;
237
218
-export type RenderRootOptions = {
219
- onUncaughtError?: (
220
- error: mixed,
221
- errorInfo: {+componentStack?: ?string},
222
- ) => void,
223
- onCaughtError?: (
224
- error: mixed,
225
- errorInfo: {
226
- +componentStack?: ?string,
227
- +errorBoundary?: ?React$Component<any, any>,
228
- },
229
- ) => void,
230
- onRecoverableError?: (
231
- error: mixed,
232
- errorInfo: {+componentStack?: ?string},
233
- ) => void,
234
-};
235
-
238
export type ReactFabricType = {
239
findHostInstance_DEPRECATED<TElementType: ElementType>(
240
componentOrHandle: ?(ElementRef<TElementType> | number),