@swan-io/lake 1.6.0 → 1.8.0
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.
- package/package.json +8 -9
- package/src/components/AutoWidthImage.d.ts +95 -3
- package/src/components/BottomPanel.js +68 -6
- package/src/components/Breadcrumbs.js +3 -3
- package/src/components/ChoicePicker.js +99 -8
- package/src/components/Filters.js +7 -1
- package/src/components/Form.d.ts +122 -3
- package/src/components/Heading.d.ts +96 -3
- package/src/components/LakeButton.js +1 -1
- package/src/components/LakeHeading.d.ts +96 -3
- package/src/components/LakeTextInput.d.ts +189 -2
- package/src/components/Link.d.ts +44 -48
- package/src/components/Pressable.d.ts +118 -122
- package/src/utils/math.d.ts +13 -0
- package/src/utils/math.js +9 -1
- package/src/utils/viewport.d.ts +2 -0
- package/src/utils/viewport.js +33 -0
|
@@ -42,41 +42,53 @@ export declare const Pressable: FC<PressableProps & ExtraProps & {
|
|
|
42
42
|
ref?: Ref<View> | undefined;
|
|
43
43
|
}>;
|
|
44
44
|
export declare const PressableText: FC<{
|
|
45
|
-
|
|
45
|
+
allowFontScaling?: boolean | undefined;
|
|
46
|
+
ellipsizeMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
46
47
|
id?: string | undefined;
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
48
|
+
lineBreakMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
49
|
+
numberOfLines?: number | undefined;
|
|
50
|
+
onTextLayout?: ((event: NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
|
|
51
|
+
testID?: string | undefined;
|
|
52
52
|
nativeID?: string | undefined;
|
|
53
|
-
|
|
53
|
+
maxFontSizeMultiplier?: number | null | undefined;
|
|
54
|
+
role?: import("react-native").WebRole | undefined;
|
|
55
|
+
href?: string | undefined;
|
|
56
|
+
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
57
|
+
lang?: string | undefined;
|
|
58
|
+
adjustsFontSizeToFit?: boolean | undefined;
|
|
59
|
+
minimumFontScale?: number | undefined;
|
|
60
|
+
suppressHighlighting?: boolean | undefined;
|
|
61
|
+
selectable?: boolean | undefined;
|
|
62
|
+
selectionColor?: import("react-native").ColorValue | undefined;
|
|
63
|
+
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
64
|
+
dataDetectorType?: "none" | "all" | "link" | "phoneNumber" | "email" | null | undefined;
|
|
65
|
+
android_hyphenationFrequency?: "normal" | "none" | "full" | undefined;
|
|
54
66
|
accessible?: boolean | undefined;
|
|
55
67
|
accessibilityActions?: readonly Readonly<{
|
|
56
68
|
name: string;
|
|
57
69
|
label?: string | undefined;
|
|
58
70
|
}>[] | undefined;
|
|
59
71
|
accessibilityLabel?: string | undefined;
|
|
60
|
-
|
|
72
|
+
'aria-label'?: string | undefined;
|
|
61
73
|
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
62
74
|
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
75
|
+
'aria-busy'?: boolean | undefined;
|
|
76
|
+
'aria-checked'?: boolean | "mixed" | undefined;
|
|
77
|
+
'aria-disabled'?: boolean | undefined;
|
|
78
|
+
'aria-expanded'?: boolean | undefined;
|
|
79
|
+
'aria-selected'?: boolean | undefined;
|
|
80
|
+
'aria-labelledby'?: string | undefined;
|
|
69
81
|
accessibilityHint?: string | undefined;
|
|
70
82
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
83
|
+
'aria-valuemax'?: number | undefined;
|
|
84
|
+
'aria-valuemin'?: number | undefined;
|
|
85
|
+
'aria-valuenow'?: number | undefined;
|
|
86
|
+
'aria-valuetext'?: string | undefined;
|
|
75
87
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
76
88
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
89
|
+
'aria-hidden'?: boolean | undefined;
|
|
90
|
+
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
91
|
+
'aria-modal'?: boolean | undefined;
|
|
80
92
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
81
93
|
accessibilityElementsHidden?: boolean | undefined;
|
|
82
94
|
accessibilityViewIsModal?: boolean | undefined;
|
|
@@ -84,6 +96,7 @@ export declare const PressableText: FC<{
|
|
|
84
96
|
onAccessibilityTap?: (() => void) | undefined;
|
|
85
97
|
onMagicTap?: (() => void) | undefined;
|
|
86
98
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
99
|
+
tabIndex?: 0 | -1 | undefined;
|
|
87
100
|
"aria-activedescendant"?: string | undefined;
|
|
88
101
|
"aria-atomic"?: boolean | undefined;
|
|
89
102
|
"aria-autocomplete"?: string | undefined;
|
|
@@ -115,58 +128,77 @@ export declare const PressableText: FC<{
|
|
|
115
128
|
"aria-rowspan"?: number | undefined;
|
|
116
129
|
"aria-setsize"?: number | undefined;
|
|
117
130
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
118
|
-
|
|
119
|
-
ellipsizeMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
120
|
-
lineBreakMode?: "clip" | "middle" | "head" | "tail" | undefined;
|
|
121
|
-
numberOfLines?: number | undefined;
|
|
122
|
-
onTextLayout?: ((event: NativeSyntheticEvent<import("react-native").TextLayoutEventData>) => void) | undefined;
|
|
123
|
-
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
124
|
-
onPressIn?: ((event: unknown) => void) | undefined;
|
|
125
|
-
onPressOut?: ((event: unknown) => void) | undefined;
|
|
126
|
-
onLongPress?: ((event: unknown) => void) | undefined;
|
|
127
|
-
maxFontSizeMultiplier?: number | null | undefined;
|
|
128
|
-
href?: string | undefined;
|
|
129
|
-
hrefAttrs?: import("react-native").HrefAttrs | undefined;
|
|
130
|
-
lang?: string | undefined;
|
|
131
|
-
adjustsFontSizeToFit?: boolean | undefined;
|
|
132
|
-
minimumFontScale?: number | undefined;
|
|
133
|
-
suppressHighlighting?: boolean | undefined;
|
|
134
|
-
disabled?: boolean | undefined;
|
|
135
|
-
selectable?: boolean | undefined;
|
|
136
|
-
selectionColor?: import("react-native").ColorValue | undefined;
|
|
137
|
-
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
138
|
-
dataDetectorType?: "none" | "all" | "link" | "phoneNumber" | "email" | null | undefined;
|
|
139
|
-
android_hyphenationFrequency?: "normal" | "none" | "full" | undefined;
|
|
140
|
-
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
141
|
-
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
142
|
-
onPressMove?: ((event: unknown) => void) | undefined;
|
|
131
|
+
children?: string | number | boolean | import("react").ReactElement<any, string | import("react").JSXElementConstructor<any>> | import("react").ReactFragment | import("react").ReactPortal | ((state: PressableStateCallbackType) => ReactNode) | null | undefined;
|
|
143
132
|
delayLongPress?: number | undefined;
|
|
144
133
|
delayPressIn?: number | undefined;
|
|
145
134
|
delayPressOut?: number | undefined;
|
|
135
|
+
disabled?: boolean | undefined;
|
|
136
|
+
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
146
137
|
onContextMenu?: ((event: NativeSyntheticEvent<React.SyntheticEvent>) => void) | undefined;
|
|
138
|
+
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
147
139
|
onHoverIn?: ((event: unknown) => void) | undefined;
|
|
148
140
|
onHoverOut?: ((event: unknown) => void) | undefined;
|
|
141
|
+
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
142
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
143
|
+
onLongPress?: PressResponderConfig["onLongPress"];
|
|
144
|
+
onPress?: PressResponderConfig["onPress"];
|
|
145
|
+
onPressIn?: PressResponderConfig["onPressStart"];
|
|
146
|
+
onPressMove?: PressResponderConfig["onPressMove"];
|
|
147
|
+
onPressOut?: PressResponderConfig["onPressEnd"];
|
|
148
|
+
style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
|
|
149
149
|
testOnly_hovered?: boolean | undefined;
|
|
150
150
|
testOnly_pressed?: boolean | undefined;
|
|
151
151
|
} & {
|
|
152
152
|
ref?: Ref<Text> | undefined;
|
|
153
153
|
}>;
|
|
154
|
-
export declare const PressableTextInput: FC<
|
|
154
|
+
export declare const PressableTextInput: FC<{
|
|
155
|
+
allowFontScaling?: boolean | undefined;
|
|
156
|
+
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
157
|
+
autoCorrect?: boolean | undefined;
|
|
158
|
+
autoFocus?: boolean | undefined;
|
|
159
|
+
blurOnSubmit?: boolean | undefined;
|
|
160
|
+
caretHidden?: boolean | undefined;
|
|
161
|
+
contextMenuHidden?: boolean | undefined;
|
|
162
|
+
defaultValue?: string | undefined;
|
|
163
|
+
inputMode?: import("react-native").InputModeOptions | undefined;
|
|
164
|
+
maxLength?: number | undefined;
|
|
165
|
+
multiline?: boolean | undefined;
|
|
166
|
+
onChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
|
|
167
|
+
onChangeText?: ((text: string) => void) | undefined;
|
|
168
|
+
onContentSizeChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
|
|
169
|
+
onEndEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
|
|
170
|
+
onSelectionChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
|
|
171
|
+
onSubmitEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputSubmitEditingEventData>) => void) | undefined;
|
|
172
|
+
onTextInput?: ((e: NativeSyntheticEvent<import("react-native").TextInputTextInputEventData>) => void) | undefined;
|
|
173
|
+
onScroll?: ((e: NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
|
|
174
|
+
onKeyPress?: ((e: NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
|
|
175
|
+
placeholder?: string | undefined;
|
|
176
|
+
placeholderTextColor?: import("react-native").ColorValue | undefined;
|
|
177
|
+
returnKeyType?: import("react-native").ReturnKeyTypeOptions | undefined;
|
|
178
|
+
secureTextEntry?: boolean | undefined;
|
|
179
|
+
selectTextOnFocus?: boolean | undefined;
|
|
180
|
+
selection?: {
|
|
181
|
+
start: number;
|
|
182
|
+
end?: number | undefined;
|
|
183
|
+
} | undefined;
|
|
184
|
+
selectionColor?: import("react-native").ColorValue | undefined;
|
|
155
185
|
textAlign?: "left" | "right" | "center" | undefined;
|
|
156
186
|
testID?: string | undefined;
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
id?: string | undefined;
|
|
187
|
+
inputAccessoryViewID?: string | undefined;
|
|
188
|
+
value?: string | undefined;
|
|
189
|
+
maxFontSizeMultiplier?: number | null | undefined;
|
|
161
190
|
role?: import("react-native").WebRole | undefined;
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
191
|
+
lang?: string | undefined;
|
|
192
|
+
initialValue?: string | undefined;
|
|
193
|
+
autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday" | "bday-day" | "bday-month" | "bday-year" | "cc-additional-name" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "impp" | "language" | "new-password" | "nickname" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
|
|
194
|
+
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
|
|
195
|
+
rows?: number | undefined;
|
|
196
|
+
readOnly?: boolean | undefined;
|
|
165
197
|
hitSlop?: import("react-native").Insets | undefined;
|
|
166
|
-
|
|
198
|
+
id?: string | undefined;
|
|
199
|
+
pointerEvents?: "auto" | "none" | "box-none" | "box-only" | undefined;
|
|
167
200
|
removeClippedSubviews?: boolean | undefined;
|
|
168
201
|
nativeID?: string | undefined;
|
|
169
|
-
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
170
202
|
onKeyDownCapture?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
171
203
|
onKeyUp?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
172
204
|
onKeyUpCapture?: ((event: NativeSyntheticEvent<import("react").KeyboardEvent<Element>>) => void) | undefined;
|
|
@@ -217,26 +249,26 @@ export declare const PressableTextInput: FC<Except<{
|
|
|
217
249
|
label?: string | undefined;
|
|
218
250
|
}>[] | undefined;
|
|
219
251
|
accessibilityLabel?: string | undefined;
|
|
220
|
-
|
|
252
|
+
'aria-label'?: string | undefined;
|
|
221
253
|
accessibilityRole?: import("react-native").AccessibilityRole | undefined;
|
|
222
254
|
accessibilityState?: import("react-native").AccessibilityState | undefined;
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
255
|
+
'aria-busy'?: boolean | undefined;
|
|
256
|
+
'aria-checked'?: boolean | "mixed" | undefined;
|
|
257
|
+
'aria-disabled'?: boolean | undefined;
|
|
258
|
+
'aria-expanded'?: boolean | undefined;
|
|
259
|
+
'aria-selected'?: boolean | undefined;
|
|
260
|
+
'aria-labelledby'?: string | undefined;
|
|
229
261
|
accessibilityHint?: string | undefined;
|
|
230
262
|
accessibilityValue?: import("react-native").AccessibilityValue | undefined;
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
263
|
+
'aria-valuemax'?: number | undefined;
|
|
264
|
+
'aria-valuemin'?: number | undefined;
|
|
265
|
+
'aria-valuenow'?: number | undefined;
|
|
266
|
+
'aria-valuetext'?: string | undefined;
|
|
235
267
|
onAccessibilityAction?: ((event: import("react-native").AccessibilityActionEvent) => void) | undefined;
|
|
236
268
|
importantForAccessibility?: "auto" | "yes" | "no" | "no-hide-descendants" | undefined;
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
269
|
+
'aria-hidden'?: boolean | undefined;
|
|
270
|
+
'aria-live'?: "polite" | "assertive" | "off" | undefined;
|
|
271
|
+
'aria-modal'?: boolean | undefined;
|
|
240
272
|
accessibilityLiveRegion?: "none" | "polite" | "assertive" | undefined;
|
|
241
273
|
accessibilityElementsHidden?: boolean | undefined;
|
|
242
274
|
accessibilityViewIsModal?: boolean | undefined;
|
|
@@ -244,6 +276,7 @@ export declare const PressableTextInput: FC<Except<{
|
|
|
244
276
|
onAccessibilityTap?: (() => void) | undefined;
|
|
245
277
|
onMagicTap?: (() => void) | undefined;
|
|
246
278
|
accessibilityIgnoresInvertColors?: boolean | undefined;
|
|
279
|
+
tabIndex?: 0 | -1 | undefined;
|
|
247
280
|
"aria-activedescendant"?: string | undefined;
|
|
248
281
|
"aria-atomic"?: boolean | undefined;
|
|
249
282
|
"aria-autocomplete"?: string | undefined;
|
|
@@ -275,56 +308,6 @@ export declare const PressableTextInput: FC<Except<{
|
|
|
275
308
|
"aria-rowspan"?: number | undefined;
|
|
276
309
|
"aria-setsize"?: number | undefined;
|
|
277
310
|
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined;
|
|
278
|
-
value?: string | undefined;
|
|
279
|
-
allowFontScaling?: boolean | undefined;
|
|
280
|
-
numberOfLines?: number | undefined;
|
|
281
|
-
onPress?: ((event: import("react-native").GestureResponderEvent) => void) | undefined;
|
|
282
|
-
onPressIn?: ((event: unknown) => void) | undefined;
|
|
283
|
-
onPressOut?: ((event: unknown) => void) | undefined;
|
|
284
|
-
onLongPress?: ((event: unknown) => void) | undefined;
|
|
285
|
-
maxFontSizeMultiplier?: number | null | undefined;
|
|
286
|
-
lang?: string | undefined;
|
|
287
|
-
disabled?: boolean | undefined;
|
|
288
|
-
selectionColor?: import("react-native").ColorValue | undefined;
|
|
289
|
-
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
290
|
-
placeholderTextColor?: import("react-native").ColorValue | undefined;
|
|
291
|
-
readOnly?: boolean | undefined;
|
|
292
|
-
editable?: boolean | undefined;
|
|
293
|
-
keyboardType?: import("react-native").KeyboardTypeOptions | undefined;
|
|
294
|
-
onChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputChangeEventData>) => void) | undefined;
|
|
295
|
-
autoCapitalize?: "none" | "sentences" | "words" | "characters" | undefined;
|
|
296
|
-
autoCorrect?: boolean | undefined;
|
|
297
|
-
autoFocus?: boolean | undefined;
|
|
298
|
-
blurOnSubmit?: boolean | undefined;
|
|
299
|
-
caretHidden?: boolean | undefined;
|
|
300
|
-
contextMenuHidden?: boolean | undefined;
|
|
301
|
-
defaultValue?: string | undefined;
|
|
302
|
-
inputMode?: import("react-native").InputModeOptions | undefined;
|
|
303
|
-
maxLength?: number | undefined;
|
|
304
|
-
multiline?: boolean | undefined;
|
|
305
|
-
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
306
|
-
onChangeText?: ((text: string) => void) | undefined;
|
|
307
|
-
onContentSizeChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputContentSizeChangeEventData>) => void) | undefined;
|
|
308
|
-
onEndEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputEndEditingEventData>) => void) | undefined;
|
|
309
|
-
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
310
|
-
onSelectionChange?: ((e: NativeSyntheticEvent<import("react-native").TextInputSelectionChangeEventData>) => void) | undefined;
|
|
311
|
-
onSubmitEditing?: ((e: NativeSyntheticEvent<import("react-native").TextInputSubmitEditingEventData>) => void) | undefined;
|
|
312
|
-
onTextInput?: ((e: NativeSyntheticEvent<import("react-native").TextInputTextInputEventData>) => void) | undefined;
|
|
313
|
-
onScroll?: ((e: NativeSyntheticEvent<import("react-native").TextInputScrollEventData>) => void) | undefined;
|
|
314
|
-
onKeyPress?: ((e: NativeSyntheticEvent<import("react-native").TextInputKeyPressEventData>) => void) | undefined;
|
|
315
|
-
placeholder?: string | undefined;
|
|
316
|
-
returnKeyType?: import("react-native").ReturnKeyTypeOptions | undefined;
|
|
317
|
-
secureTextEntry?: boolean | undefined;
|
|
318
|
-
selectTextOnFocus?: boolean | undefined;
|
|
319
|
-
selection?: {
|
|
320
|
-
start: number;
|
|
321
|
-
end?: number | undefined;
|
|
322
|
-
} | undefined;
|
|
323
|
-
inputAccessoryViewID?: string | undefined;
|
|
324
|
-
initialValue?: string | undefined;
|
|
325
|
-
autoComplete?: "off" | "name" | "email" | "tel" | "url" | "additional-name" | "address-level1" | "address-level2" | "address-level3" | "address-level4" | "address-line1" | "address-line2" | "address-line3" | "bday" | "bday-day" | "bday-month" | "bday-year" | "cc-additional-name" | "cc-csc" | "cc-exp" | "cc-exp-month" | "cc-exp-year" | "cc-family-name" | "cc-given-name" | "cc-name" | "cc-number" | "cc-type" | "country" | "country-name" | "current-password" | "family-name" | "given-name" | "honorific-prefix" | "honorific-suffix" | "impp" | "language" | "new-password" | "nickname" | "on" | "one-time-code" | "organization" | "organization-title" | "postal-code" | "sex" | "street-address" | "tel-area-code" | "tel-country-code" | "tel-extension" | "tel-local" | "tel-national" | "transaction-amount" | "transaction-currency" | "username" | undefined;
|
|
326
|
-
enterKeyHint?: "enter" | "search" | "done" | "go" | "next" | "send" | "previous" | undefined;
|
|
327
|
-
rows?: number | undefined;
|
|
328
311
|
clearButtonMode?: "never" | "while-editing" | "unless-editing" | "always" | undefined;
|
|
329
312
|
clearTextOnFocus?: boolean | undefined;
|
|
330
313
|
dataDetectorTypes?: import("react-native").DataDetectorTypes | import("react-native").DataDetectorTypes[] | undefined;
|
|
@@ -342,18 +325,31 @@ export declare const PressableTextInput: FC<Except<{
|
|
|
342
325
|
inlineImageLeft?: string | undefined;
|
|
343
326
|
inlineImagePadding?: number | undefined;
|
|
344
327
|
returnKeyLabel?: string | undefined;
|
|
328
|
+
textBreakStrategy?: "simple" | "highQuality" | "balanced" | undefined;
|
|
345
329
|
underlineColorAndroid?: import("react-native").ColorValue | undefined;
|
|
330
|
+
textAlignVertical?: "bottom" | "top" | "auto" | "center" | undefined;
|
|
346
331
|
showSoftInputOnFocus?: boolean | undefined;
|
|
347
|
-
|
|
332
|
+
verticalAlign?: "bottom" | "top" | "auto" | "middle" | undefined;
|
|
348
333
|
delayLongPress?: number | undefined;
|
|
349
334
|
delayPressIn?: number | undefined;
|
|
350
335
|
delayPressOut?: number | undefined;
|
|
336
|
+
disabled?: boolean | undefined;
|
|
337
|
+
onBlur?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
351
338
|
onContextMenu?: ((event: NativeSyntheticEvent<React.SyntheticEvent>) => void) | undefined;
|
|
339
|
+
onFocus?: ((event: NativeSyntheticEvent<React.FocusEvent>) => void) | undefined;
|
|
352
340
|
onHoverIn?: ((event: unknown) => void) | undefined;
|
|
353
341
|
onHoverOut?: ((event: unknown) => void) | undefined;
|
|
342
|
+
onKeyDown?: ((event: NativeSyntheticEvent<React.KeyboardEvent>) => void) | undefined;
|
|
343
|
+
onLayout?: ((event: import("react-native").LayoutChangeEvent) => void) | undefined;
|
|
344
|
+
onLongPress?: PressResponderConfig["onLongPress"];
|
|
345
|
+
onPress?: PressResponderConfig["onPress"];
|
|
346
|
+
onPressIn?: PressResponderConfig["onPressStart"];
|
|
347
|
+
onPressMove?: PressResponderConfig["onPressMove"];
|
|
348
|
+
onPressOut?: PressResponderConfig["onPressEnd"];
|
|
349
|
+
style?: false | import("react-native").TextStyle | import("react-native").RegisteredStyle<import("react-native").TextStyle> | import("react-native").RecursiveArray<import("react-native").TextStyle | import("react-native").Falsy | import("react-native").RegisteredStyle<import("react-native").TextStyle>> | ((state: PressableStateCallbackType) => import("react-native").StyleProp<import("react-native").TextStyle>) | null | undefined;
|
|
354
350
|
testOnly_hovered?: boolean | undefined;
|
|
355
351
|
testOnly_pressed?: boolean | undefined;
|
|
356
|
-
}
|
|
352
|
+
} & {
|
|
357
353
|
ref?: Ref<TextInput> | undefined;
|
|
358
354
|
}>;
|
|
359
355
|
export {};
|
package/src/utils/math.d.ts
CHANGED
|
@@ -8,9 +8,22 @@ type InterpolateParams<T extends InterpolateTuple> = {
|
|
|
8
8
|
outputRange: FixedLength<T["length"]>;
|
|
9
9
|
clamp?: boolean;
|
|
10
10
|
};
|
|
11
|
+
export declare const clampValue: (min: number, max: number) => (value: number) => number;
|
|
11
12
|
/**
|
|
12
13
|
* This function is similar to `Animated.interpolate` except this one can be used with numbers
|
|
13
14
|
* Whereas `Animated.interpolate` works only with animated values and return a listener, not a single value
|
|
14
15
|
*/
|
|
15
16
|
export declare const interpolate: <T extends InterpolateTuple>({ inputRange: input, outputRange: output, clamp, }: InterpolateParams<T>) => (value: number) => number;
|
|
17
|
+
type ElasticParams = {
|
|
18
|
+
elasticLength?: number;
|
|
19
|
+
elasticStrength?: number;
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* This function takes as input a number from 0 to Infinity and returns a number from 0 to elasticLength
|
|
23
|
+
* With an exponential curve giving a feeling of elasticity
|
|
24
|
+
* This kind of function can be used to:
|
|
25
|
+
* - recreate effect like scroll bounce on iOS
|
|
26
|
+
* - limit grab smoothly with touch interaction
|
|
27
|
+
*/
|
|
28
|
+
export declare const limitElastic: ({ elasticLength, elasticStrength }: ElasticParams) => (value: number) => number;
|
|
16
29
|
export {};
|
package/src/utils/math.js
CHANGED
|
@@ -6,7 +6,7 @@ const getValue = (array, index, name) => {
|
|
|
6
6
|
}
|
|
7
7
|
return value;
|
|
8
8
|
};
|
|
9
|
-
const clampValue = (min, max) => (value) => Math.max(Math.min(value, max), min);
|
|
9
|
+
export const clampValue = (min, max) => (value) => Math.max(Math.min(value, max), min);
|
|
10
10
|
// Here we can disable no-non-null-assertion because this function is called in interpolate which have types checking if there is at least 2 values in range
|
|
11
11
|
const getRangeIndexes = (range, value) => {
|
|
12
12
|
if (value < range[0]) {
|
|
@@ -45,3 +45,11 @@ export const interpolate = ({ inputRange: input, outputRange: output, clamp = tr
|
|
|
45
45
|
return outputValue;
|
|
46
46
|
};
|
|
47
47
|
};
|
|
48
|
+
/**
|
|
49
|
+
* This function takes as input a number from 0 to Infinity and returns a number from 0 to elasticLength
|
|
50
|
+
* With an exponential curve giving a feeling of elasticity
|
|
51
|
+
* This kind of function can be used to:
|
|
52
|
+
* - recreate effect like scroll bounce on iOS
|
|
53
|
+
* - limit grab smoothly with touch interaction
|
|
54
|
+
*/
|
|
55
|
+
export const limitElastic = ({ elasticLength = 100, elasticStrength = 0.008 }) => (value) => elasticLength * (1 - Math.exp(-elasticStrength * value));
|
package/src/utils/viewport.d.ts
CHANGED
package/src/utils/viewport.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Future } from "@swan-io/boxed";
|
|
1
2
|
import { isNotNullish } from "./nullish";
|
|
2
3
|
import { isSafari } from "./userAgent";
|
|
3
4
|
// Prevents Safari from zooming automatically on inputs, still allow user to zoom manually
|
|
@@ -10,3 +11,35 @@ export const preventSafariAutoZoomOnInputs = () => {
|
|
|
10
11
|
}
|
|
11
12
|
}
|
|
12
13
|
};
|
|
14
|
+
// When using `node.scroll()` with smooth behavior, there isn't any event to detect when the scroll animation is finished
|
|
15
|
+
// We need this also with `ScrollView.scrollTo` (which just call the native node.scroll function)
|
|
16
|
+
// More info about why this workaround: https://stackoverflow.com/a/60001032
|
|
17
|
+
export const detectScrollAnimationEnd = (element) => {
|
|
18
|
+
let lastScrollTop = element.scrollTop;
|
|
19
|
+
let lastScrollLeft = element.scrollLeft;
|
|
20
|
+
return Future.make(resolve => {
|
|
21
|
+
let frame;
|
|
22
|
+
// We need to wait a bit before starting the loop because first requestAnimationFrame is called before the scroll animation starts
|
|
23
|
+
const timeout = setTimeout(() => {
|
|
24
|
+
const loop = () => {
|
|
25
|
+
frame = requestAnimationFrame(() => {
|
|
26
|
+
if (lastScrollTop !== element.scrollTop || lastScrollLeft !== element.scrollLeft) {
|
|
27
|
+
lastScrollTop = element.scrollTop;
|
|
28
|
+
lastScrollLeft = element.scrollLeft;
|
|
29
|
+
loop();
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
resolve();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
};
|
|
36
|
+
loop();
|
|
37
|
+
}, 50);
|
|
38
|
+
return () => {
|
|
39
|
+
clearTimeout(timeout);
|
|
40
|
+
if (frame != null) {
|
|
41
|
+
cancelAnimationFrame(frame);
|
|
42
|
+
}
|
|
43
|
+
};
|
|
44
|
+
});
|
|
45
|
+
};
|