Commit d21f1dd
authored
[General] Update button's animation duration props (#4046)
## Description
Native platforms delay touches when the button is inside a ScrollView.
This may cause situations where press-out is triggered immediately after
press-in, effectively running with no animation.
This PR:
- changes the easing on web to better align with native platforms
- changes `animationDuration` to `pressAndHoldAnimationDuration`
- adds `tapAnimationDuration`
`pressAndHoldAnimationDuration` defaults to `tapAnimationDuration` when
unspecified; `tapAnimationDuration` defaults to 100ms.
Press out handler now has three branches:
1. pressDuration >= `pressAndHoldAnimationDuration` -> press out
animation is started immediately with the duration of
`pressAndHoldAnimationDuration`
2. pressDuration * 2 in [`tapAnimationDuration`,
`pressAndHoldAnimationDuration`] (*2 so there's at least half of
`tapAnimationDuration` for the remaining animation) -> press out
animation is started immediately with the duration of the press so far
3. pressDuration < `tapAnimationDuration / 2` -> pressIn animation is
played fully in the remaining time in `tapAnimationDuration`, and
pressOut is scheduled after with the duration of `tapAnimationDuration`
## Test plan
Updated the button underlay example1 parent 72f2d3e commit d21f1dd
8 files changed
Lines changed: 254 additions & 37 deletions
File tree
- apps/common-app/src/new_api/components/button_underlay
- packages/react-native-gesture-handler
- android/src/main/java/com/swmansion/gesturehandler/react
- apple
- src
- components
- specs
Lines changed: 4 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
12 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
13 | 15 | | |
14 | 16 | | |
15 | 17 | | |
| |||
Lines changed: 51 additions & 8 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
15 | 15 | | |
16 | 16 | | |
17 | 17 | | |
| 18 | + | |
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| |||
266 | 267 | | |
267 | 268 | | |
268 | 269 | | |
269 | | - | |
270 | | - | |
271 | | - | |
| 270 | + | |
| 271 | + | |
| 272 | + | |
| 273 | + | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
| 277 | + | |
272 | 278 | | |
273 | 279 | | |
274 | 280 | | |
| |||
346 | 352 | | |
347 | 353 | | |
348 | 354 | | |
349 | | - | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
350 | 358 | | |
351 | 359 | | |
352 | 360 | | |
| |||
369 | 377 | | |
370 | 378 | | |
371 | 379 | | |
| 380 | + | |
| 381 | + | |
372 | 382 | | |
373 | 383 | | |
374 | 384 | | |
| |||
487 | 497 | | |
488 | 498 | | |
489 | 499 | | |
490 | | - | |
| 500 | + | |
491 | 501 | | |
492 | 502 | | |
493 | 503 | | |
| |||
509 | 519 | | |
510 | 520 | | |
511 | 521 | | |
512 | | - | |
| 522 | + | |
513 | 523 | | |
514 | 524 | | |
515 | 525 | | |
516 | 526 | | |
517 | 527 | | |
518 | 528 | | |
519 | | - | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
520 | 535 | | |
521 | 536 | | |
522 | 537 | | |
523 | | - | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
524 | 559 | | |
525 | 560 | | |
526 | 561 | | |
| |||
630 | 665 | | |
631 | 666 | | |
632 | 667 | | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
633 | 676 | | |
634 | 677 | | |
635 | 678 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
| 31 | + | |
31 | 32 | | |
32 | 33 | | |
33 | 34 | | |
| |||
Lines changed: 122 additions & 13 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
47 | 49 | | |
48 | 50 | | |
| 51 | + | |
| 52 | + | |
49 | 53 | | |
50 | 54 | | |
51 | 55 | | |
52 | 56 | | |
53 | 57 | | |
54 | 58 | | |
55 | | - | |
| 59 | + | |
| 60 | + | |
56 | 61 | | |
57 | 62 | | |
58 | 63 | | |
59 | 64 | | |
60 | 65 | | |
61 | 66 | | |
62 | 67 | | |
| 68 | + | |
| 69 | + | |
63 | 70 | | |
64 | 71 | | |
65 | 72 | | |
| |||
96 | 103 | | |
97 | 104 | | |
98 | 105 | | |
| 106 | + | |
| 107 | + | |
| 108 | + | |
| 109 | + | |
| 110 | + | |
| 111 | + | |
| 112 | + | |
| 113 | + | |
| 114 | + | |
| 115 | + | |
| 116 | + | |
| 117 | + | |
| 118 | + | |
| 119 | + | |
| 120 | + | |
| 121 | + | |
| 122 | + | |
| 123 | + | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
| 127 | + | |
| 128 | + | |
| 129 | + | |
| 130 | + | |
| 131 | + | |
| 132 | + | |
| 133 | + | |
| 134 | + | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
| 139 | + | |
99 | 140 | | |
100 | 141 | | |
101 | 142 | | |
| |||
149 | 190 | | |
150 | 191 | | |
151 | 192 | | |
152 | | - | |
| 193 | + | |
153 | 194 | | |
| 195 | + | |
| 196 | + | |
| 197 | + | |
| 198 | + | |
154 | 199 | | |
155 | | - | |
| 200 | + | |
156 | 201 | | |
157 | | - | |
| 202 | + | |
158 | 203 | | |
159 | 204 | | |
160 | 205 | | |
| |||
199 | 244 | | |
200 | 245 | | |
201 | 246 | | |
202 | | - | |
| 247 | + | |
| 248 | + | |
| 249 | + | |
| 250 | + | |
203 | 251 | | |
204 | | - | |
| 252 | + | |
| 253 | + | |
| 254 | + | |
205 | 255 | | |
206 | 256 | | |
| 257 | + | |
| 258 | + | |
| 259 | + | |
207 | 260 | | |
208 | 261 | | |
209 | | - | |
| 262 | + | |
210 | 263 | | |
211 | 264 | | |
212 | 265 | | |
| |||
218 | 271 | | |
219 | 272 | | |
220 | 273 | | |
| 274 | + | |
| 275 | + | |
| 276 | + | |
221 | 277 | | |
222 | 278 | | |
223 | 279 | | |
| |||
236 | 292 | | |
237 | 293 | | |
238 | 294 | | |
| 295 | + | |
| 296 | + | |
| 297 | + | |
| 298 | + | |
| 299 | + | |
239 | 300 | | |
240 | | - | |
| 301 | + | |
241 | 302 | | |
242 | | - | |
| 303 | + | |
243 | 304 | | |
244 | 305 | | |
245 | 306 | | |
246 | 307 | | |
247 | 308 | | |
248 | | - | |
249 | | - | |
250 | | - | |
251 | | - | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
| 352 | + | |
| 353 | + | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
252 | 361 | | |
253 | 362 | | |
254 | 363 | | |
| |||
Lines changed: 2 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
241 | 241 | | |
242 | 242 | | |
243 | 243 | | |
244 | | - | |
| 244 | + | |
| 245 | + | |
245 | 246 | | |
246 | 247 | | |
247 | 248 | | |
| |||
Lines changed: 11 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
59 | 59 | | |
60 | 60 | | |
61 | 61 | | |
62 | | - | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
63 | 65 | | |
64 | | - | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
65 | 74 | | |
66 | 75 | | |
67 | 76 | | |
| |||
0 commit comments