From cf94797f93decb45fb3c3b9eb60ae0b12e765e10 Mon Sep 17 00:00:00 2001 From: Fabrizio Cucci Date: Tue, 21 May 2024 07:40:51 -0700 Subject: [PATCH] Resolve $FlowFixMe in Pressable (#44634) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/44634 Changelog: [Internal] As per title. Reviewed By: NickGerleman Differential Revision: D57612982 fbshipit-source-id: 5aafd38889b3db49a5f4360563e1803169d9b943 --- .../Libraries/Components/Pressable/Pressable.js | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/packages/react-native/Libraries/Components/Pressable/Pressable.js b/packages/react-native/Libraries/Components/Pressable/Pressable.js index ef8dccaa830..de350029419 100644 --- a/packages/react-native/Libraries/Components/Pressable/Pressable.js +++ b/packages/react-native/Libraries/Components/Pressable/Pressable.js @@ -195,13 +195,16 @@ type Props = $ReadOnly<{| 'aria-label'?: ?string, |}>; +type Instance = React.ElementRef; + /** * Component used to build display components that should respond to whether the * component is currently pressed or not. */ -/* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's - * LTI update could not be added via codemod */ -function Pressable(props: Props, forwardedRef): React.Node { +function Pressable( + props: Props, + forwardedRef: React.RefSetter, +): React.Node { const { accessible, accessibilityState, @@ -235,7 +238,7 @@ function Pressable(props: Props, forwardedRef): React.Node { ...restProps } = props; - const viewRef = useRef | null>(null); + const viewRef = useRef(null); const mergedRef = useMergeRefs(forwardedRef, viewRef); const android_rippleConfig = useAndroidRippleForView(android_ripple, viewRef);