Skip to content

Commit 6129d3c

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Make use of ref-as-prop support in TouchableBounce (facebook#51369)
Summary: Pull Request resolved: facebook#51369 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: D74815336 fbshipit-source-id: b45f563ee73bd53794319b0d9886d3214caf0544
1 parent 0312e99 commit 6129d3c

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

packages/react-native/Libraries/Components/Touchable/TouchableBounce.js

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -221,9 +221,15 @@ class TouchableBounce extends React.Component<
221221
}
222222
}
223223

224-
export default (React.forwardRef((props, hostRef: React.RefSetter<mixed>) => (
225-
<TouchableBounce {...props} hostRef={hostRef} />
226-
)): component(
224+
export default (function TouchableBounceWrapper({
225+
ref: hostRef,
226+
...props
227+
}: {
228+
ref: React.RefSetter<mixed>,
229+
...$ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>,
230+
}) {
231+
return <TouchableBounce {...props} hostRef={hostRef} />;
232+
} as component(
227233
ref: React.RefSetter<mixed>,
228234
...props: $ReadOnly<Omit<TouchableBounceProps, 'hostRef'>>
229235
));

0 commit comments

Comments
 (0)