mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
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
This commit is contained in:
@@ -22,6 +22,7 @@ import type {
|
||||
AccessibilityState,
|
||||
AccessibilityValue,
|
||||
} from '../View/ViewAccessibility';
|
||||
import {PressabilityDebugView} from '../../Pressability/PressabilityDebug';
|
||||
import usePressability from '../../Pressability/usePressability';
|
||||
import {normalizeRect, type RectOrSize} from '../../StyleSheet/Rect';
|
||||
import type {ColorValue} from '../../StyleSheet/StyleSheetTypes';
|
||||
@@ -220,6 +221,7 @@ function Pressable(props: Props, forwardedRef): React.Node {
|
||||
ref={viewRef}
|
||||
style={typeof style === 'function' ? style({pressed}) : style}>
|
||||
{typeof children === 'function' ? children({pressed}) : children}
|
||||
{__DEV__ ? <PressabilityDebugView color="red" hitSlop={hitSlop} /> : null}
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user