Skip to content

Commit 0b6fad6

Browse files
yungstersgrabbou
authored andcommittedMay 26, 2020
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 fb429a5 commit 0b6fad6

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 {ColorValue} from '../../StyleSheet/StyleSheetTypes';
@@ -220,6 +221,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
220221
ref={viewRef}
221222
style={typeof style === 'function' ? style({pressed}) : style}>
222223
{typeof children === 'function' ? children({pressed}) : children}
224+
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
223225
</View>
224226
);
225227
}

0 commit comments

Comments
 (0)
Please sign in to comment.