diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts index 01bdf53ca1d6..bd72669a22c4 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts +++ b/packages/react-native/Libraries/Components/Touchable/TouchableOpacity.d.ts @@ -8,10 +8,7 @@ */ import type * as React from 'react'; -import {Constructor} from '../../../types/private/Utilities'; -import {TimerMixin} from '../../../types/private/TimerMixin'; -import {NativeMethods} from '../../../types/public/ReactNativeTypes'; -import {TouchableMixin} from './Touchable'; +import {View} from '../../Components/View/View'; import {TouchableWithoutFeedbackProps} from './TouchableWithoutFeedback'; export interface TVProps { @@ -79,14 +76,6 @@ export interface TouchableOpacityProps * * @see https://reactnative.dev/docs/touchableopacity */ -declare class TouchableOpacityComponent extends React.Component {} -declare const TouchableOpacityBase: Constructor & - Constructor & - Constructor & - typeof TouchableOpacityComponent; -export class TouchableOpacity extends TouchableOpacityBase { - /** - * Animate the touchable to a new opacity. - */ - setOpacityTo: (value: number) => void; -} +export const TouchableOpacity: React.ForwardRefExoticComponent< + React.PropsWithoutRef & React.RefAttributes +>; diff --git a/packages/react-native/types/__typetests__/index.tsx b/packages/react-native/types/__typetests__/index.tsx index 9f4ec9ed7476..c68dae4b027b 100644 --- a/packages/react-native/types/__typetests__/index.tsx +++ b/packages/react-native/types/__typetests__/index.tsx @@ -485,9 +485,26 @@ function TouchableTest() { } export class TouchableOpacityTest extends React.Component { + buttonRef = React.createRef>(); + render() { return ( <> + + { + ref?.focus(); + ref?.blur(); + ref?.measure( + (x, y, width, height, pageX, pageY): number => + x + y + width + height + pageX + pageY, + ); + ref?.measureInWindow( + (x, y, width, height): number => x + y + width + height, + ); + ref?.setNativeProps({focusable: false}); + }} + />