Make use of ref-as-prop support in TouchableHighlight (#51364)

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

Make use of the React 19 feature so that we can remove the remaining `forwardRef` in react native.

Changelog: [Internal]

Reviewed By: yungsters

Differential Revision: D74814121

fbshipit-source-id: b9b9f09577da1ba59a4b858b538140ab34bdc60d
This commit is contained in:
Sam Zhou authored and Facebook GitHub Bot committed 2025-05-15 13:49:17 -07:00
1 parent 80482d6be3
commit 22a55dc9b9
1 file changed
+7 -3
@@ -408,9 +408,13 @@ class TouchableHighlightImpl extends React.Component<
const TouchableHighlight: component(
ref?: React.RefSetter<React.ElementRef<typeof View>>,
...props: $ReadOnly<Omit<TouchableHighlightProps, 'hostRef'>>
) = React.forwardRef((props, hostRef) => (
<TouchableHighlightImpl {...props} hostRef={hostRef} />
));
) = ({
ref: hostRef,
...props
}: {
ref?: React.RefSetter<React.ElementRef<typeof View>>,
...$ReadOnly<Omit<TouchableHighlightProps, 'hostRef'>>,
}) => <TouchableHighlightImpl {...props} hostRef={hostRef} />;
TouchableHighlight.displayName = 'TouchableHighlight';