1 |
|
2 | import { AccessibilityProps, ViewProps, Insets, StyleProp, ViewStyle, PressableStateCallbackType as RNPressableStateCallbackType, PressableAndroidRippleConfig as RNPressableAndroidRippleConfig } from 'react-native';
|
3 | export type PressableStateCallbackType = RNPressableStateCallbackType;
|
4 | export type PressableAndroidRippleConfig = RNPressableAndroidRippleConfig;
|
5 | export type InnerPressableEvent = {
|
6 | changedTouches: InnerPressableEvent[];
|
7 | identifier: number;
|
8 | locationX: number;
|
9 | locationY: number;
|
10 | pageX: number;
|
11 | pageY: number;
|
12 | target: number;
|
13 | timestamp: number;
|
14 | touches: InnerPressableEvent[];
|
15 | force?: number;
|
16 | };
|
17 | export type PressableEvent = {
|
18 | nativeEvent: InnerPressableEvent;
|
19 | };
|
20 | export interface PressableProps extends AccessibilityProps, Omit<ViewProps, 'children' | 'style' | 'hitSlop'> {
|
21 | |
22 |
|
23 |
|
24 | onHoverIn?: null | ((event: PressableEvent) => void);
|
25 | /**
|
26 | * Called when the hover is deactivated to undo visual feedback.
|
27 | */
|
28 | onHoverOut?: null | ((event: PressableEvent) => void);
|
29 | /**
|
30 | * Called when a single tap gesture is detected.
|
31 | */
|
32 | onPress?: null | ((event: PressableEvent) => void);
|
33 | /**
|
34 | * Called when a touch is engaged before `onPress`.
|
35 | */
|
36 | onPressIn?: null | ((event: PressableEvent) => void);
|
37 | /**
|
38 | * Called when a touch is released before `onPress`.
|
39 | */
|
40 | onPressOut?: null | ((event: PressableEvent) => void);
|
41 | /**
|
42 | * Called when a long-tap gesture is detected.
|
43 | */
|
44 | onLongPress?: null | ((event: PressableEvent) => void);
|
45 | /**
|
46 | * Either children or a render prop that receives a boolean reflecting whether
|
47 | * the component is currently pressed.
|
48 | */
|
49 | children?: React.ReactNode | ((state: PressableStateCallbackType) => React.ReactNode);
|
50 | /**
|
51 | * Whether a press gesture can be interrupted by a parent gesture such as a
|
52 | * scroll event. Defaults to true.
|
53 | */
|
54 | cancelable?: null | boolean;
|
55 | /**
|
56 | * Duration to wait after hover in before calling `onHoverIn`.
|
57 | * @platform web macos
|
58 | *
|
59 | * NOTE: not present in RN docs
|
60 | */
|
61 | delayHoverIn?: number | null;
|
62 | /**
|
63 | * Duration to wait after hover out before calling `onHoverOut`.
|
64 | * @platform web macos
|
65 | *
|
66 | * NOTE: not present in RN docs
|
67 | */
|
68 | delayHoverOut?: number | null;
|
69 | /**
|
70 | * Duration (in milliseconds) from `onPressIn` before `onLongPress` is called.
|
71 | */
|
72 | delayLongPress?: null | number;
|
73 | /**
|
74 | * Whether the press behavior is disabled.
|
75 | */
|
76 | disabled?: null | boolean;
|
77 | /**
|
78 | * Additional distance outside of this view in which a press is detected.
|
79 | */
|
80 | hitSlop?: null | Insets | number;
|
81 | /**
|
82 | * Additional distance outside of this view in which a touch is considered a
|
83 | * press before `onPressOut` is triggered.
|
84 | */
|
85 | pressRetentionOffset?: null | Insets | number;
|
86 | /**
|
87 | * If true, doesn't play system sound on touch.
|
88 | * @platform android
|
89 | */
|
90 | android_disableSound?: null | boolean;
|
91 | /**
|
92 | * Enables the Android ripple effect and configures its color.
|
93 | * @platform android
|
94 | */
|
95 | android_ripple?: null | PressableAndroidRippleConfig;
|
96 | /**
|
97 | * Used only for documentation or testing (e.g. snapshot testing).
|
98 | */
|
99 | testOnly_pressed?: null | boolean;
|
100 | /**
|
101 | * Either view styles or a function that receives a boolean reflecting whether
|
102 | * the component is currently pressed and returns view styles.
|
103 | */
|
104 | style?: StyleProp<ViewStyle> | ((state: PressableStateCallbackType) => StyleProp<ViewStyle>);
|
105 | /**
|
106 | * Duration (in milliseconds) to wait after press down before calling onPressIn.
|
107 | */
|
108 | unstable_pressDelay?: number;
|
109 | }
|
110 |
|
\ | No newline at end of file |