1 |
|
2 |
|
3 |
|
4 |
|
5 |
|
6 |
|
7 |
|
8 |
|
9 |
|
10 | import {GestureResponderEvent} from '../../Libraries/Types/CoreEventTypes';
|
11 |
|
12 |
|
13 |
|
14 |
|
15 |
|
16 |
|
17 |
|
18 |
|
19 |
|
20 |
|
21 |
|
22 |
|
23 |
|
24 |
|
25 |
|
26 |
|
27 |
|
28 |
|
29 |
|
30 |
|
31 |
|
32 |
|
33 |
|
34 |
|
35 |
|
36 |
|
37 | export interface GestureResponderHandlers {
|
38 | |
39 |
|
40 |
|
41 |
|
42 |
|
43 | |
44 |
|
45 |
|
46 | onStartShouldSetResponder?:
|
47 | | ((event: GestureResponderEvent) => boolean)
|
48 | | undefined;
|
49 |
|
50 | /**
|
51 | * Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
|
52 | */
|
53 | onMoveShouldSetResponder?:
|
54 | | ((event: GestureResponderEvent) => boolean)
|
55 | | undefined;
|
56 |
|
57 | /**
|
58 | * If the View returns true and attempts to become the responder, one of the following will happen:
|
59 | */
|
60 |
|
61 | onResponderEnd?: ((event: GestureResponderEvent) => void) | undefined;
|
62 |
|
63 | /**
|
64 | * The View is now responding for touch events.
|
65 | * This is the time to highlight and show the user what is happening
|
66 | */
|
67 | onResponderGrant?: ((event: GestureResponderEvent) => void) | undefined;
|
68 |
|
69 | /**
|
70 | * Something else is the responder right now and will not release it
|
71 | */
|
72 | onResponderReject?: ((event: GestureResponderEvent) => void) | undefined;
|
73 |
|
74 | /**
|
75 | * If the view is responding, the following handlers can be called:
|
76 | */
|
77 |
|
78 | /**
|
79 | * The user is moving their finger
|
80 | */
|
81 | onResponderMove?: ((event: GestureResponderEvent) => void) | undefined;
|
82 |
|
83 | /**
|
84 | * Fired at the end of the touch, ie "touchUp"
|
85 | */
|
86 | onResponderRelease?: ((event: GestureResponderEvent) => void) | undefined;
|
87 |
|
88 | onResponderStart?: ((event: GestureResponderEvent) => void) | undefined;
|
89 |
|
90 | /**
|
91 | * Something else wants to become responder.
|
92 | * Should this view release the responder? Returning true allows release
|
93 | */
|
94 | onResponderTerminationRequest?:
|
95 | | ((event: GestureResponderEvent) => boolean)
|
96 | | undefined;
|
97 |
|
98 | /**
|
99 | * The responder has been taken from the View.
|
100 | * Might be taken by other views after a call to onResponderTerminationRequest,
|
101 | * or might be taken by the OS without asking (happens with control center/ notification center on iOS)
|
102 | */
|
103 | onResponderTerminate?: ((event: GestureResponderEvent) => void) | undefined;
|
104 |
|
105 | /**
|
106 | * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
107 | * where the deepest node is called first.
|
108 | * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
|
109 | * This is desirable in most cases, because it makes sure all controls and buttons are usable.
|
110 | *
|
111 | * However, sometimes a parent will want to make sure that it becomes responder.
|
112 | * This can be handled by using the capture phase.
|
113 | * Before the responder system bubbles up from the deepest component,
|
114 | * it will do a capture phase, firing on*ShouldSetResponderCapture.
|
115 | * So if a parent View wants to prevent the child from becoming responder on a touch start,
|
116 | * it should have a onStartShouldSetResponderCapture handler which returns true.
|
117 | */
|
118 | onStartShouldSetResponderCapture?:
|
119 | | ((event: GestureResponderEvent) => boolean)
|
120 | | undefined;
|
121 |
|
122 | /**
|
123 | * onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
124 | * where the deepest node is called first.
|
125 | * That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
|
126 | * This is desirable in most cases, because it makes sure all controls and buttons are usable.
|
127 | *
|
128 | * However, sometimes a parent will want to make sure that it becomes responder.
|
129 | * This can be handled by using the capture phase.
|
130 | * Before the responder system bubbles up from the deepest component,
|
131 | * it will do a capture phase, firing on*ShouldSetResponderCapture.
|
132 | * So if a parent View wants to prevent the child from becoming responder on a touch start,
|
133 | * it should have a onStartShouldSetResponderCapture handler which returns true.
|
134 | */
|
135 | onMoveShouldSetResponderCapture?:
|
136 | | ((event: GestureResponderEvent) => boolean)
|
137 | | undefined;
|
138 | }
|
139 |
|
140 | /**
|
141 | * React Native also implements unstable_batchedUpdates
|
142 | */
|
143 | export function unstable_batchedUpdates<A, R>(callback: (a: A) => R, a: A): R;
|
144 | export function unstable_batchedUpdates<R>(callback: () => R): R;
|
145 |
|
\ | No newline at end of file |