Skip to content

Commit

Permalink
Pressable: Add Support for Inspector Overlay
Browse files Browse the repository at this point in the history
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
  • Loading branch information
yungsters authored and facebook-github-bot committed May 18, 2020
1 parent b72d676 commit 8ac467c
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions Libraries/Components/Pressable/Pressable.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 {LayoutEvent, PressEvent} from '../../Types/CoreEventTypes';
Expand Down Expand Up @@ -219,6 +220,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>
);
}
Expand Down

0 comments on commit 8ac467c

Please sign in to comment.