Skip to content

Commit 8ac467c

Browse files
yungstersfacebook-github-bot
authored andcommitted
Pressable: Add Support for Inspector Overlay
Summary: Adds support for the debug overlay (enabled via the Inspector) that the legacy touchable components supported. Changelog: [General][Added] - Added Inspector overlay support for Pressable Reviewed By: TheSavior Differential Revision: D21614412 fbshipit-source-id: b884e04f8dba1bfd35e61de25d33d6d47bc34b03
1 parent b72d676 commit 8ac467c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

Libraries/Components/Pressable/Pressable.js

+2
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ import type {
2222
AccessibilityState,
2323
AccessibilityValue,
2424
} from '../View/ViewAccessibility';
25+
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
2526
import usePressability from '../../Pressability/usePressability';
2627
import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect';
2728
import type {LayoutEvent, PressEvent} from '../../Types/CoreEventTypes';
@@ -219,6 +220,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
219220
ref={viewRef}
220221
style={typeof style === 'function' ? style({pressed}) : style}>
221222
{typeof children === 'function' ? children({pressed}) : children}
223+
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
222224
</View>
223225
);
224226
}

0 commit comments

Comments
 (0)