Skip to content

Commit 6205aad

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Eliminate usage of more than 1-arg React.AbstractComponent in React codebase (facebook#31314)
Summary: <!-- Thanks for submitting a pull request! We appreciate you spending the time to work on these changes. Please provide enough information so that others can review your pull request. The three fields below are mandatory. Before submitting a pull request, please make sure the following is done: 1. Fork [the repository](https://github.com/facebook/react) and create your branch from `main`. 2. Run `yarn` in the repository root. 3. If you've fixed a bug or added code that should be tested, add tests! 4. Ensure the test suite passes (`yarn test`). Tip: `yarn test --watch TestName` is helpful in development. 5. Run `yarn test --prod` to test in the production environment. It supports the same options as `yarn test`. 6. If you need a debugger, run `yarn test --debug --watch TestName`, open `chrome://inspect`, and press "Inspect". 7. Format your code with [prettier](https://github.com/prettier/prettier) (`yarn prettier`). 8. Make sure your code lints (`yarn lint`). Tip: `yarn linc` to only check changed files. 9. Run the [Flow](https://flowtype.org/) type checks (`yarn flow`). 10. If you haven't already, complete the CLA. Learn more about contributing: https://reactjs.org/docs/how-to-contribute.html --> ## Summary In order to adopt react 19's ref-as-prop model, Flow needs to eliminate all the places where they are treated differently. `React.AbstractComponent` is the worst example of this, and we need to eliminate it. This PR eliminates them from the react repo, and only keeps the one that has 1 argument of props. ## How did you test this change? yarn flow DiffTrain build for [45804af18d589fd2c181f3b020f07661c46b73ea](facebook/react@45804af) Reviewed By: jbrown215 Differential Revision: D64725736 Pulled By: SamChou19815 fbshipit-source-id: c9f6f316c95d12a9ae98926faba111395b550ccf
1 parent 363818e commit 6205aad

File tree

1 file changed

+9
-10
lines changed

1 file changed

+9
-10
lines changed

packages/react-native/Libraries/Renderer/shims/ReactNativeTypes.js

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -7,15 +7,10 @@
77
* @noformat
88
* @nolint
99
* @flow strict
10-
* @generated SignedSource<<448b89d0a61a392d9c1eb921f7d51d37>>
10+
* @generated SignedSource<<9cf3e28d6ca0299bc0bb5caa75b19556>>
1111
*/
1212

13-
import type {
14-
ElementRef,
15-
ElementType,
16-
MixedElement,
17-
AbstractComponent,
18-
} from 'react';
13+
import type {ElementRef, ElementType, MixedElement} from 'react';
1914

2015
export type MeasureOnSuccessCallback = (
2116
x: number,
@@ -138,7 +133,9 @@ declare const ensureNativeMethodsAreSynced: NativeMethods;
138133
(ensureNativeMethodsAreSynced: INativeMethods);
139134

140135
export type HostInstance = NativeMethods;
141-
export type HostComponent<Config> = AbstractComponent<Config, HostInstance>;
136+
/*::
137+
export type HostComponent<Config: {...}> = component(ref: React$RefSetter<HostInstance>, ...Config);
138+
*/
142139

143140
type InspectorDataProps = $ReadOnly<{
144141
[propName: string]: string,
@@ -209,8 +206,10 @@ export type ReactNativeType = {
209206
componentOrHandle: ?(ElementRef<TElementType> | number),
210207
): ?number,
211208
isChildPublicInstance(
212-
parent: PublicInstance | HostComponent<mixed>,
213-
child: PublicInstance | HostComponent<mixed>,
209+
// eslint-disable-next-line no-undef
210+
parent: PublicInstance | HostComponent<empty>,
211+
// eslint-disable-next-line no-undef
212+
child: PublicInstance | HostComponent<empty>,
214213
): boolean,
215214
dispatchCommand(
216215
handle: HostInstance,

0 commit comments

Comments
 (0)