Replace React.AbstractComponent with component type in Switch (#46911)

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

Prepare for the ref-as-prop typing change in flow.

Changelog: [Internal]

Reviewed By: SamChou19815

Differential Revision: D64103195

fbshipit-source-id: e0ff745c70df910dcb84ed3a824d67883bbfc44d
This commit is contained in:
Fabrizio Cucci
2024-10-09 12:55:12 -07:00
committed by Facebook GitHub Bot
parent 3102a58df3
commit 37e0973bb3
2 changed files with 14 additions and 11 deletions
@@ -130,12 +130,14 @@ const returnsTrue = () => true;
```
*/
const SwitchWithForwardedRef: React.AbstractComponent<
Props,
React.ElementRef<
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
>,
> = React.forwardRef(function Switch(props, forwardedRef): React.Node {
type SwitchRef = React.ElementRef<
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
>;
const SwitchWithForwardedRef: component(
ref: React.RefSetter<SwitchRef>,
...props: Props
) = React.forwardRef(function Switch(props, forwardedRef): React.Node {
const {
disabled,
ios_backgroundColor,
@@ -2529,12 +2529,13 @@ export type Props = $ReadOnly<{|
onChange?: ?(event: SwitchChangeEvent) => Promise<void> | void,
onValueChange?: ?(value: boolean) => Promise<void> | void,
|}>;
declare const SwitchWithForwardedRef: React.AbstractComponent<
Props,
React.ElementRef<
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
>,
type SwitchRef = React.ElementRef<
typeof SwitchNativeComponent | typeof AndroidSwitchNativeComponent,
>;
declare const SwitchWithForwardedRef: component(
ref: React.RefSetter<SwitchRef>,
...props: Props
);
declare export default typeof SwitchWithForwardedRef;
"
`;