Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New onSwipeableOpenDragStart and onSwipeableCloseDragStart events #2589

Merged
merged 5 commits into from
Sep 20, 2023

Conversation

rampazzo1989
Copy link
Contributor

@rampazzo1989 rampazzo1989 commented Sep 16, 2023

Description

Fixes #935
The event onSwipeableWillOpen only starts right before the onSwipeableOpen event, not when the drag to open / close starts. This PR includes onSwipeableOpenStartDrag (direction: 'left' | 'right') and onSwipeableCloseStartDrag (direction: 'left' | 'right'), allowing execute actions when the animation to open/close starts (when drag starts).

Test plan

Tested in the example app.

@rampazzo1989 rampazzo1989 changed the title feat: new onSwipeableOpenDragStart and onSwipeableCloseDragStart events New onSwipeableOpenDragStart and onSwipeableCloseDragStart events Sep 16, 2023
@matheusinfo
Copy link

That would be great, i already had this problem on my app and had to fix it manually with patch

@marcelogaldino
Copy link

Very nice @rampazzo1989! I was looking for a solution like that. Any updates for this Pull Request ?

Copy link
Contributor

@m-bert m-bert left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @rampazzo1989, thanks for this PR! It looks ok, but I'd like you to make some cosmetic changes, so I've left some comments.

src/components/Swipeable.tsx Outdated Show resolved Hide resolved
src/components/Swipeable.tsx Outdated Show resolved Hide resolved
src/components/Swipeable.tsx Outdated Show resolved Hide resolved
@rampazzo1989
Copy link
Contributor Author

Hi @rampazzo1989, thanks for this PR! It looks ok, but I'd like you to make some cosmetic changes, so I've left some comments.

Thank you for the review @m-bert! I've done the changes, really got better!

src/components/Swipeable.tsx Show resolved Hide resolved
@m-bert
Copy link
Contributor

m-bert commented Sep 20, 2023

Now it looks much better, thank you once again! ✅

@m-bert m-bert merged commit cf22c4b into software-mansion:main Sep 20, 2023
1 check passed
renovate bot referenced this pull request in valora-inc/wallet Oct 15, 2023
…4315)

[![Mend
Renovate](https://app.renovatebot.com/images/banner.svg)](https://renovatebot.com)

This PR contains the following updates:

| Package | Change | Age | Adoption | Passing | Confidence |
|---|---|---|---|---|---|
|
[react-native-gesture-handler](https://github.com/software-mansion/react-native-gesture-handler)
| [`^2.13.1` ->
`^2.13.2`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.13.1/2.13.2)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.13.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.13.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.13.1/2.13.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.13.1/2.13.2?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

<details>
<summary>software-mansion/react-native-gesture-handler
(react-native-gesture-handler)</summary>

###
[`v2.13.2`](https://github.com/software-mansion/react-native-gesture-handler/releases/tag/2.13.2)

[Compare
Source](https://github.com/software-mansion/react-native-gesture-handler/compare/2.13.1...2.13.2)

#### 🐛 Bug fixes

- Add `ghQueueMicrotask` by
[@&#8203;m-bert](https://github.com/m-bert) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2612](https://github.com/software-mansion/react-native-gesture-handler/pull/2612)

#### 👍 Improvements

- New onSwipeableOpenDragStart and onSwipeableCloseDragStart events by
[@&#8203;rampazzo1989](https://github.com/rampazzo1989) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2589](https://github.com/software-mansion/react-native-gesture-handler/pull/2589)
- Remove jcenter by
[@&#8203;ChaseKnowlden](https://github.com/ChaseKnowlden) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2610](https://github.com/software-mansion/react-native-gesture-handler/pull/2610)
- Add buildconfig flag for AGP8+ by
[@&#8203;pvegh](https://github.com/pvegh) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2599](https://github.com/software-mansion/react-native-gesture-handler/pull/2599)

#### 🔢 Miscellaneous

- Update dependencies in e2e/web-tests by
[@&#8203;m-bert](https://github.com/m-bert) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2601](https://github.com/software-mansion/react-native-gesture-handler/pull/2601)
- Bump [@&#8203;sideway/formula](https://github.com/sideway/formula)
from 3.0.0 to 3.0.1 in /FabricExample by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2605](https://github.com/software-mansion/react-native-gesture-handler/pull/2605)
- Bump [@&#8203;sideway/formula](https://github.com/sideway/formula)
from 3.0.0 to 3.0.1 in /docs by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2602](https://github.com/software-mansion/react-native-gesture-handler/pull/2602)
- Give some love to Gesture Handler docs by
[@&#8203;kacperkapusciak](https://github.com/kacperkapusciak) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2607](https://github.com/software-mansion/react-native-gesture-handler/pull/2607)
- Fix typo in Composing gestures docs by
[@&#8203;S1D007](https://github.com/S1D007) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2614](https://github.com/software-mansion/react-native-gesture-handler/pull/2614)
- Bump postcss from 8.4.30 to 8.4.31 in /e2e/web-tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2623](https://github.com/software-mansion/react-native-gesture-handler/pull/2623)
- Bump postcss from 8.4.14 to 8.4.31 in /docs by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2621](https://github.com/software-mansion/react-native-gesture-handler/pull/2621)
- Bump [@&#8203;sideway/formula](https://github.com/sideway/formula)
from 3.0.0 to 3.0.1 in /example by
[@&#8203;dependabot](https://github.com/dependabot) in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2606](https://github.com/software-mansion/react-native-gesture-handler/pull/2606)

#### New Contributors

- [@&#8203;rampazzo1989](https://github.com/rampazzo1989) made their
first contribution in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2589](https://github.com/software-mansion/react-native-gesture-handler/pull/2589)
- [@&#8203;ChaseKnowlden](https://github.com/ChaseKnowlden) made their
first contribution in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2610](https://github.com/software-mansion/react-native-gesture-handler/pull/2610)
- [@&#8203;pvegh](https://github.com/pvegh) made their first
contribution in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2599](https://github.com/software-mansion/react-native-gesture-handler/pull/2599)
- [@&#8203;S1D007](https://github.com/S1D007) made their first
contribution in
[https://github.com/software-mansion/react-native-gesture-handler/pull/2614](https://github.com/software-mansion/react-native-gesture-handler/pull/2614)

**Full Changelog**:
software-mansion/react-native-gesture-handler@2.13.1...2.13.2

</details>

---

### Configuration

📅 **Schedule**: Branch creation - "after 5pm,every weekend" in timezone
America/Los_Angeles, Automerge - "after 5pm,every weekend" in timezone
America/Los_Angeles.

🚦 **Automerge**: Enabled.

♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the
rebase/retry checkbox.

🔕 **Ignore**: Close this PR and you won't be reminded about this update
again.

---

- [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check
this box

---

This PR has been generated by [Mend
Renovate](https://www.mend.io/free-developer-tools/renovate/). View
repository job log
[here](https://developer.mend.io/github/valora-inc/wallet).

<!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiIzNy44LjEiLCJ1cGRhdGVkSW5WZXIiOiIzNy44LjEiLCJ0YXJnZXRCcmFuY2giOiJtYWluIn0=-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
@latekvo
Copy link
Contributor

latekvo commented Oct 11, 2024

Hey @rampazzo1989,

when working on ReanimatedSwipeable, i encountered this part of your code:

const direction =
  rowState === -1
    ? 'right'
    : rowState === 1
    ? 'left'
    : translationX > 0
    ? 'left'
    : 'right';

When swiping to the left when the left panel is open, it returns left, but when swiping to the left when no panels are open, it returns right.

So when returning left and right to the callback, was your intention to return the swipe direction or the side of the panel that would be opened?

On another note, do you think the callbacks should always receive the swiping direction like they do when no panels are open, or should it stay how it is, with swiping direction returned always being right when right panel is open, and left when left one is?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Wrong fire onSwipeableWillOpen
5 participants