From 22a55dc9b92ae49956581add5b1732b74bcbed84 Mon Sep 17 00:00:00 2001 From: Sam Zhou Date: Thu, 15 May 2025 13:49:17 -0700 Subject: [PATCH] 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 --- .../Components/Touchable/TouchableHighlight.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js index a5abfba39cb..28314ffde10 100644 --- a/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js +++ b/packages/react-native/Libraries/Components/Touchable/TouchableHighlight.js @@ -408,9 +408,13 @@ class TouchableHighlightImpl extends React.Component< const TouchableHighlight: component( ref?: React.RefSetter>, ...props: $ReadOnly> -) = React.forwardRef((props, hostRef) => ( - -)); +) = ({ + ref: hostRef, + ...props +}: { + ref?: React.RefSetter>, + ...$ReadOnly>, +}) => ; TouchableHighlight.displayName = 'TouchableHighlight';