-
-
Notifications
You must be signed in to change notification settings - Fork 1k
Add testing-library
compatibility props
#3357
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 9 commits
122d977
e51fdcd
9828131
930dabc
f1ac3ce
c63a561
556f8f2
f13e7b0
4d942e8
7a31f5e
6184078
4ec26c4
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,7 +20,7 @@ import { | |
} from './utils'; | ||
import { PressabilityDebugView } from '../../handlers/PressabilityDebugView'; | ||
import { GestureTouchEvent } from '../../handlers/gestureHandlerCommon'; | ||
import { INT32_MAX } from '../../utils'; | ||
import { INT32_MAX, isTestEnv } from '../../utils'; | ||
|
||
const DEFAULT_LONG_PRESS_DURATION = 500; | ||
|
||
|
@@ -390,7 +390,10 @@ export default function Pressable(props: PressableProps) { | |
touchSoundDisabled={android_disableSound ?? undefined} | ||
rippleColor={processColor(android_ripple?.color ?? defaultRippleColor)} | ||
rippleRadius={android_ripple?.radius ?? undefined} | ||
style={[pointerStyle, styleProp]}> | ||
style={[pointerStyle, styleProp]} | ||
testOnly_onPress={isTestEnv() ? onPress : undefined} | ||
testOnly_onPressIn={isTestEnv() ? onPressIn : undefined} | ||
testOnly_onPressOut={isTestEnv() ? onPressOut : undefined}> | ||
|
||
{childrenProp} | ||
{__DEV__ ? ( | ||
<PressabilityDebugView color="red" hitSlop={normalizedHitSlop} /> | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What kind of argument should be passed to
testOnly_onPress
?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
testOnly_onPress
will currently always be of type((event: PressableEvent) => void) | null
, but this may change if more of our components will implementtestOnly_onPress
.I've made it of type
Function
, becauseRawButtonProps
usage is not specific toPressable
.Link to type definitions: (link)
Extract from type definitions: