react-native 0.87.0-rc.0 → 0.87.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,261 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @generated SignedSource<<81be4da4cec114a71bce2b6e263588a1>>
8
- *
9
- * This file was translated from Flow by scripts/js-api/build-types/index.js.
10
- * Original file: packages/react-native/Libraries/Components/Touchable/Touchable.js
11
- */
12
-
13
- import type { EdgeInsetsProp } from "../../StyleSheet/EdgeInsetsPropType";
14
- import type { ColorValue } from "../../StyleSheet/StyleSheet";
15
- import type { BlurEvent, FocusEvent, GestureResponderEvent } from "../../Types/CoreEventTypes";
16
- import * as React from "react";
17
- /**
18
- * Touchable states.
19
- */
20
-
21
- declare const States: {
22
- NOT_RESPONDER: "NOT_RESPONDER";
23
- RESPONDER_INACTIVE_PRESS_IN: "RESPONDER_INACTIVE_PRESS_IN";
24
- RESPONDER_INACTIVE_PRESS_OUT: "RESPONDER_INACTIVE_PRESS_OUT";
25
- RESPONDER_ACTIVE_PRESS_IN: "RESPONDER_ACTIVE_PRESS_IN";
26
- RESPONDER_ACTIVE_PRESS_OUT: "RESPONDER_ACTIVE_PRESS_OUT";
27
- RESPONDER_ACTIVE_LONG_PRESS_IN: "RESPONDER_ACTIVE_LONG_PRESS_IN";
28
- RESPONDER_ACTIVE_LONG_PRESS_OUT: "RESPONDER_ACTIVE_LONG_PRESS_OUT";
29
- ERROR: "ERROR";
30
- };
31
- type TouchableState = typeof States.NOT_RESPONDER | typeof States.RESPONDER_INACTIVE_PRESS_IN | typeof States.RESPONDER_INACTIVE_PRESS_OUT | typeof States.RESPONDER_ACTIVE_PRESS_IN | typeof States.RESPONDER_ACTIVE_PRESS_OUT | typeof States.RESPONDER_ACTIVE_LONG_PRESS_IN | typeof States.RESPONDER_ACTIVE_LONG_PRESS_OUT | typeof States.ERROR;
32
- /**
33
- * By convention, methods prefixed with underscores are meant to be @private,
34
- * and not @protected. Mixers shouldn't access them - not even to provide them
35
- * as callback handlers.
36
- *
37
- *
38
- * ========== Geometry =========
39
- * `Touchable` only assumes that there exists a `HitRect` node. The `PressRect`
40
- * is an abstract box that is extended beyond the `HitRect`.
41
- *
42
- * +--------------------------+
43
- * | | - "Start" events in `HitRect` cause `HitRect`
44
- * | +--------------------+ | to become the responder.
45
- * | | +--------------+ | | - `HitRect` is typically expanded around
46
- * | | | | | | the `VisualRect`, but shifted downward.
47
- * | | | VisualRect | | | - After pressing down, after some delay,
48
- * | | | | | | and before letting up, the Visual React
49
- * | | +--------------+ | | will become "active". This makes it eligible
50
- * | | HitRect | | for being highlighted (so long as the
51
- * | +--------------------+ | press remains in the `PressRect`).
52
- * | PressRect o |
53
- * +----------------------|---+
54
- * Out Region |
55
- * +-----+ This gap between the `HitRect` and
56
- * `PressRect` allows a touch to move far away
57
- * from the original hit rect, and remain
58
- * highlighted, and eligible for a "Press".
59
- * Customize this via
60
- * `touchableGetPressRectOffset()`.
61
- *
62
- *
63
- *
64
- * ======= State Machine =======
65
- *
66
- * +-------------+ <---+ RESPONDER_RELEASE
67
- * |NOT_RESPONDER|
68
- * +-------------+ <---+ RESPONDER_TERMINATED
69
- * +
70
- * | RESPONDER_GRANT (HitRect)
71
- * v
72
- * +---------------------------+ DELAY +-------------------------+ T + DELAY +------------------------------+
73
- * |RESPONDER_INACTIVE_PRESS_IN|+-------->|RESPONDER_ACTIVE_PRESS_IN| +------------> |RESPONDER_ACTIVE_LONG_PRESS_IN|
74
- * +---------------------------+ +-------------------------+ +------------------------------+
75
- * + ^ + ^ + ^
76
- * |LEAVE_ |ENTER_ |LEAVE_ |ENTER_ |LEAVE_ |ENTER_
77
- * |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT |PRESS_RECT
78
- * | | | | | |
79
- * v + v + v +
80
- * +----------------------------+ DELAY +--------------------------+ +-------------------------------+
81
- * |RESPONDER_INACTIVE_PRESS_OUT|+------->|RESPONDER_ACTIVE_PRESS_OUT| |RESPONDER_ACTIVE_LONG_PRESS_OUT|
82
- * +----------------------------+ +--------------------------+ +-------------------------------+
83
- *
84
- * T + DELAY => LONG_PRESS_DELAY_MS + DELAY
85
- *
86
- * Not drawn are the side effects of each transition. The most important side
87
- * effect is the `touchableHandlePress` abstract method invocation that occurs
88
- * when a responder is released while in either of the "Press" states.
89
- *
90
- * The other important side effects are the highlight abstract method
91
- * invocations (internal callbacks) to be implemented by the mixer.
92
- *
93
- *
94
- * @lends Touchable.prototype
95
- */
96
- declare const TouchableMixinImpl: {
97
- componentDidMount: () => void;
98
- /**
99
- * Clear all timeouts on unmount
100
- */
101
- componentWillUnmount: () => void;
102
- /**
103
- * It's prefer that mixins determine state in this way, having the class
104
- * explicitly mix the state in the one and only `getInitialState` method.
105
- *
106
- * @return {object} State object to be placed inside of
107
- * `this.state.touchable`.
108
- */
109
- touchableGetInitialState: () => {
110
- touchable: {
111
- touchState: TouchableState | undefined;
112
- responderID: GestureResponderEvent["currentTarget"] | undefined;
113
- };
114
- };
115
- /**
116
- * Must return true if embedded in a native platform scroll view.
117
- */
118
- touchableHandleResponderTerminationRequest: () => any;
119
- /**
120
- * Must return true to start the process of `Touchable`.
121
- */
122
- touchableHandleStartShouldSetResponder: () => any;
123
- /**
124
- * Return true to cancel press on long press.
125
- */
126
- touchableLongPressCancelsPress: () => boolean;
127
- /**
128
- * Place as callback for a DOM element's `onResponderGrant` event.
129
- * @param {NativeSyntheticEvent} e Synthetic event from event system.
130
- *
131
- */
132
- touchableHandleResponderGrant: (e: GestureResponderEvent) => void;
133
- /**
134
- * Place as callback for a DOM element's `onResponderRelease` event.
135
- */
136
- touchableHandleResponderRelease: (e: GestureResponderEvent) => void;
137
- /**
138
- * Place as callback for a DOM element's `onResponderTerminate` event.
139
- */
140
- touchableHandleResponderTerminate: (e: GestureResponderEvent) => void;
141
- /**
142
- * Place as callback for a DOM element's `onResponderMove` event.
143
- */
144
- touchableHandleResponderMove: (e: GestureResponderEvent) => void;
145
- /**
146
- * Invoked when the item receives focus. Mixers might override this to
147
- * visually distinguish the `VisualRect` so that the user knows that it
148
- * currently has the focus. Most platforms only support a single element being
149
- * focused at a time, in which case there may have been a previously focused
150
- * element that was blurred just prior to this. This can be overridden when
151
- * using `Touchable.Mixin.withoutDefaultFocusAndBlur`.
152
- */
153
- touchableHandleFocus: (e: FocusEvent) => void;
154
- /**
155
- * Invoked when the item loses focus. Mixers might override this to
156
- * visually distinguish the `VisualRect` so that the user knows that it
157
- * no longer has focus. Most platforms only support a single element being
158
- * focused at a time, in which case the focus may have moved to another.
159
- * This can be overridden when using
160
- * `Touchable.Mixin.withoutDefaultFocusAndBlur`.
161
- */
162
- touchableHandleBlur: (e: BlurEvent) => void;
163
- withoutDefaultFocusAndBlur: {};
164
- };
165
- declare const TouchableImpl: {
166
- Mixin: typeof TouchableMixinImpl;
167
- /**
168
- * Renders a debugging overlay to visualize touch target with hitSlop (might not work on Android).
169
- */
170
- renderDebugView: ($$PARAM_0$$: {
171
- color: ColorValue;
172
- hitSlop?: EdgeInsetsProp;
173
- }) => null | React.ReactNode;
174
- };
175
- /**
176
- * `Touchable`: Taps done right.
177
- *
178
- * You hook your `ResponderEventPlugin` events into `Touchable`. `Touchable`
179
- * will measure time/geometry and tells you when to give feedback to the user.
180
- *
181
- * ====================== Touchable Tutorial ===============================
182
- * The `Touchable` mixin helps you handle the "press" interaction. It analyzes
183
- * the geometry of elements, and observes when another responder (scroll view
184
- * etc) has stolen the touch lock. It notifies your component when it should
185
- * give feedback to the user. (bouncing/highlighting/unhighlighting).
186
- *
187
- * - When a touch was activated (typically you highlight)
188
- * - When a touch was deactivated (typically you unhighlight)
189
- * - When a touch was "pressed" - a touch ended while still within the geometry
190
- * of the element, and no other element (like scroller) has "stolen" touch
191
- * lock ("responder") (Typically you bounce the element).
192
- *
193
- * A good tap interaction isn't as simple as you might think. There should be a
194
- * slight delay before showing a highlight when starting a touch. If a
195
- * subsequent touch move exceeds the boundary of the element, it should
196
- * unhighlight, but if that same touch is brought back within the boundary, it
197
- * should rehighlight again. A touch can move in and out of that boundary
198
- * several times, each time toggling highlighting, but a "press" is only
199
- * triggered if that touch ends while within the element's boundary and no
200
- * scroller (or anything else) has stolen the lock on touches.
201
- *
202
- * To create a new type of component that handles interaction using the
203
- * `Touchable` mixin, do the following:
204
- *
205
- * - Initialize the `Touchable` state.
206
- *
207
- * getInitialState: function() {
208
- * return merge(this.touchableGetInitialState(), yourComponentState);
209
- * }
210
- *
211
- * - Choose the rendered component who's touches should start the interactive
212
- * sequence. On that rendered node, forward all `Touchable` responder
213
- * handlers. You can choose any rendered node you like. Choose a node whose
214
- * hit target you'd like to instigate the interaction sequence:
215
- *
216
- * // In render function:
217
- * return (
218
- * <View
219
- * onStartShouldSetResponder={this.touchableHandleStartShouldSetResponder}
220
- * onResponderTerminationRequest={this.touchableHandleResponderTerminationRequest}
221
- * onResponderGrant={this.touchableHandleResponderGrant}
222
- * onResponderMove={this.touchableHandleResponderMove}
223
- * onResponderRelease={this.touchableHandleResponderRelease}
224
- * onResponderTerminate={this.touchableHandleResponderTerminate}>
225
- * <View>
226
- * Even though the hit detection/interactions are triggered by the
227
- * wrapping (typically larger) node, we usually end up implementing
228
- * custom logic that highlights this inner one.
229
- * </View>
230
- * </View>
231
- * );
232
- *
233
- * - You may set up your own handlers for each of these events, so long as you
234
- * also invoke the `touchable*` handlers inside of your custom handler.
235
- *
236
- * - Implement the handlers on your component class in order to provide
237
- * feedback to the user. See documentation for each of these class methods
238
- * that you should implement.
239
- *
240
- * touchableHandlePress: function() {
241
- * this.performBounceAnimation(); // or whatever you want to do.
242
- * },
243
- * touchableHandleActivePressIn: function() {
244
- * this.beginHighlighting(...); // Whatever you like to convey activation
245
- * },
246
- * touchableHandleActivePressOut: function() {
247
- * this.endHighlighting(...); // Whatever you like to convey deactivation
248
- * },
249
- *
250
- * - There are more advanced methods you can implement (see documentation below):
251
- * touchableGetHighlightDelayMS: function() {
252
- * return 20;
253
- * }
254
- * // In practice, *always* use a predeclared constant (conserve memory).
255
- * touchableGetPressRectOffset: function() {
256
- * return {top: 20, left: 20, right: 20, bottom: 100};
257
- * }
258
- */
259
- declare const $$Touchable: typeof TouchableImpl;
260
- declare type $$Touchable = typeof $$Touchable;
261
- export default $$Touchable;
@@ -1,17 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "module": "esnext",
4
- "lib": ["es2020"],
5
- "strict": false,
6
- "noImplicitAny": true,
7
- "noImplicitThis": true,
8
- "types": [],
9
- "jsx": "react",
10
- "noEmit": true,
11
- "forceConsistentCasingInFileNames": true,
12
- "paths": {"react-native": ["."]},
13
- "moduleResolution": "bundler",
14
- "customConditions": ["react-native-strict-api"]
15
- },
16
- "include": ["**/*.d.ts", "../__typetests__/**/*"]
17
- }