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

macOS Support #2588

Merged
merged 56 commits into from
Dec 14, 2023
Merged

macOS Support #2588

merged 56 commits into from
Dec 14, 2023

Conversation

HeroBanana
Copy link
Contributor

@HeroBanana HeroBanana commented Sep 14, 2023

Description

Contains osx (MacOS) support, not completed but partly. Would be nice if we can build on top of this PR.

In order to make Gesture Handler work on macOS, we needed to:

  • rename ios/ directory to apple/ directory - this makes native modules visible both on iOS and macOS
  • use NSGestureRecognizer on macOS instead of UIGestureRecognizer - the main difference here is different subclasses, which are listed in Apple documentation page

Test plan

In theory every component made in example (ios) should work for osx, a few are ported to MacOSExample to test gestures.

This PR has been tested both on iOS (example app) and macOS (MacOSExample app).

Screen.Recording.2023-11-08.at.15.03.44.mov
Screen.Recording.2023-11-08.at.15.04.03.mov

@HeroBanana
Copy link
Contributor Author

@jfedak thanks for participating and contributing. What else need to be done to make this ready?

@jfedak
Copy link
Contributor

jfedak commented Oct 25, 2023

Hi @HeroBanana. First of all, thanks a lot for your PR. It took me some time to learn about gesture handlers on macOS and to review this PR, but in the end I made some changes that should fix everything. My changes include:

  • refactor of apple/ directory - basically I made code more similar to our react-native-reanimated repo, which makes it easier to maintain in a future
  • fix of some issues with building repo and handlers logic etc.
  • new MacOSExample app - I'm going to commit those changes today, as I wanted this app to show all of working handlers

I also plan to test it a bit more, both on macOS and iOS (to make sure everything works fine) and to do the final review.

@HeroBanana HeroBanana marked this pull request as draft October 26, 2023 13:58
@jfedak jfedak marked this pull request as ready for review November 8, 2023 11:26
@tomekzaw tomekzaw changed the title MacOS Support macOS Support Nov 8, 2023
@m-bert
Copy link
Contributor

m-bert commented Nov 29, 2023

I also don't know if we want to deal with it in this PR. This is very closely related to my next task (right click support for macOS). Imo it will be better to solve this in another PR as I don't want to do the same thing twice 😃. What do u think?

While it feels like it is something that should be done quickly, I agree that we can leave it for another PR. This one is already pretty big 😅.

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.

Few more comments.

return [RNGestureHandlerEventExtraData
forPosition:[recognizer locationInView:recognizer.view]
withAbsolutePosition:[recognizer locationInView:recognizer.view.window.contentView]
withNumberOfTouches:1 ];
Copy link
Contributor

Choose a reason for hiding this comment

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

I haven't heard the conversation that you're referring to, but do we really have information only about one pointer?

information about the number of pointers doesn't make any sense on mac, as we only have one pointer.

So how does rotation work if that's the case? Isn't there any option to get how many pointers are currently on touchpad?

Comment on lines 184 to 187
- (void)touchesBegan:(NSSet<RNGHUITouch *> *)touches withEvent:(UIEvent *)event
{
[self interactionsBegan:touches withEvent:event];
}
Copy link
Contributor

Choose a reason for hiding this comment

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

Then please add a comment explaining why it is called in another place.

I know that I probably asked twice about the same super (first why we move it into other function, and then why we move it back), sorry for that. I simply didn't see that it was brought back to interactionsBegan since all of those touches... functions have this call.

apple/Handlers/RNPinchHandler.m Outdated Show resolved Hide resolved
apple/Handlers/RNRotationHandler.m Outdated Show resolved Hide resolved
src/handlers/FlingGestureHandler.ts Outdated Show resolved Hide resolved
src/handlers/LongPressGestureHandler.ts Outdated Show resolved Hide resolved
Copy link
Member

@j-piasecki j-piasecki left a comment

Choose a reason for hiding this comment

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

:shipit:

(plz wait for @m-bert (and @tomekzaw?) to also approve 🙏)

@tomekzaw
Copy link
Member

tomekzaw commented Dec 7, 2023

it's gonna take me a while
Zrzut ekranu 2023-12-7 o 12 50 50

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.

Good job! :shipit:

Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

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

LGTM, left some minor comments. This was a tough one!

MacOSExample/README.md Outdated Show resolved Hide resolved
MacOSExample/src/App.tsx Show resolved Hide resolved
MacOSExample/src/App.tsx Outdated Show resolved Hide resolved
MacOSExample/src/basic/draggable/index.tsx Outdated Show resolved Hide resolved
MacOSExample/src/basic/draggable/index.tsx Outdated Show resolved Hide resolved
MacOSExample/src/basic/draggable/index.tsx Outdated Show resolved Hide resolved
MacOSExample/src/basic/tap/index.tsx Show resolved Hide resolved
MacOSExample/src/basic/tap/index.tsx Outdated Show resolved Hide resolved
apple/Handlers/RNForceTouchHandler.m Show resolved Hide resolved
apple/Handlers/RNPanHandler.m Show resolved Hide resolved
@jfedak jfedak requested a review from tomekzaw December 13, 2023 16:38
Copy link
Member

@tomekzaw tomekzaw left a comment

Choose a reason for hiding this comment

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

Congrats on this PR! 🎉

@HeroBanana
Copy link
Contributor Author

Thank you @jfedak for your incredible work on this PR.

@jfedak jfedak merged commit f89b1bf into software-mansion:main Dec 14, 2023
6 checks passed
@jfedak jfedak mentioned this pull request Dec 15, 2023
renovate bot added a commit to valora-inc/wallet that referenced this pull request Feb 17, 2024
…4933)

[![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.14.1` ->
`^2.15.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.14.1/2.15.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

#### ❗ Important changes

- macOS Support by [@&#8203;HeroBanana](https://github.com/HeroBanana)
and [@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2588
- feat: add visionOS support by
[@&#8203;tomekzaw](https://github.com/tomekzaw) in
[software-mansion/react-native-gesture-handler#2743
- Add `mouseButton` prop by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2676
- Migrate Gesture Handler to TurboModule by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2354

#### 🐛 Bug fixes

- Add checks for the same instance of handler usage across multiple
`GestureDetectors` by [@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2694
- Remove `didMountComponentsWithRootTag` on the new arch by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2687
- Fix double start when `activateAfterLongPress` is used by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2628
- Reset relevant handler when recognizer gets reset. by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2705
- Fix `inactive` handlers staying at finished state by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2738
- Change functions in windows module file to no-ops. by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2741
- Fix handlers coming back from being cancelled by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2704
- fix: restore ReactMethod annotation by
[@&#8203;WoLewicki](https://github.com/WoLewicki) in
[software-mansion/react-native-gesture-handler#2722

#### 🔢 Miscellaneous

- Bump react-devtools-core from 4.27.6 to 4.28.4 in /example by
[@&#8203;dependabot](https://github.com/dependabot) in
[software-mansion/react-native-gesture-handler#2650
- Add `workflow_dispatch` to workflows by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2295
- Update supported versions in readme and in docs by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2684
- Prevent GH actions trigger on forks, update template by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2696
- Auto add `Platform: MacOS` label when `MacOS` is picked in the issue
by [@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2699
- Change eslint `ban-types` to warning. by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2714
- Fix macOS warning message by
[@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2713
- Bump dependencies to stable React Native 0.73.2 by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2698
- Add macOS app icon by [@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2723
- Bump follow-redirects from 1.15.3 to 1.15.4 in /e2e/web-tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[software-mansion/react-native-gesture-handler#2719

#### New Contributors

- [@&#8203;mrousavy](https://github.com/mrousavy) made their first
contribution in
[software-mansion/react-native-gesture-handler#2690
- [@&#8203;HeroBanana](https://github.com/HeroBanana) made their first
contribution in
[software-mansion/react-native-gesture-handler#2588
- [@&#8203;fxamauri](https://github.com/fxamauri) made their first
contribution in
[software-mansion/react-native-gesture-handler#2712
- [@&#8203;jfedak](https://github.com/jfedak) made their first
contribution in
[software-mansion/react-native-gesture-handler#2713
- [@&#8203;computerjazz](https://github.com/computerjazz) made their
first contribution in
[software-mansion/react-native-gesture-handler#2715

**Full Changelog**:
software-mansion/react-native-gesture-handler@2.14.0...2.15.0

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
shottah pushed a commit to zed-io/kolektivo that referenced this pull request May 15, 2024
…alora-inc#4933)

[![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.14.1` ->
`^2.15.0`](https://renovatebot.com/diffs/npm/react-native-gesture-handler/2.14.1/2.15.0)
|
[![age](https://developer.mend.io/api/mc/badges/age/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![adoption](https://developer.mend.io/api/mc/badges/adoption/npm/react-native-gesture-handler/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![passing](https://developer.mend.io/api/mc/badges/compatibility/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|
[![confidence](https://developer.mend.io/api/mc/badges/confidence/npm/react-native-gesture-handler/2.14.1/2.15.0?slim=true)](https://docs.renovatebot.com/merge-confidence/)
|

---

### Release Notes

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

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

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

#### ❗ Important changes

- macOS Support by [@&#8203;HeroBanana](https://github.com/HeroBanana)
and [@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2588
- feat: add visionOS support by
[@&#8203;tomekzaw](https://github.com/tomekzaw) in
[software-mansion/react-native-gesture-handler#2743
- Add `mouseButton` prop by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2676
- Migrate Gesture Handler to TurboModule by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2354

#### 🐛 Bug fixes

- Add checks for the same instance of handler usage across multiple
`GestureDetectors` by [@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2694
- Remove `didMountComponentsWithRootTag` on the new arch by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2687
- Fix double start when `activateAfterLongPress` is used by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2628
- Reset relevant handler when recognizer gets reset. by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2705
- Fix `inactive` handlers staying at finished state by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2738
- Change functions in windows module file to no-ops. by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2741
- Fix handlers coming back from being cancelled by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2704
- fix: restore ReactMethod annotation by
[@&#8203;WoLewicki](https://github.com/WoLewicki) in
[software-mansion/react-native-gesture-handler#2722

#### 🔢 Miscellaneous

- Bump react-devtools-core from 4.27.6 to 4.28.4 in /example by
[@&#8203;dependabot](https://github.com/dependabot) in
[software-mansion/react-native-gesture-handler#2650
- Add `workflow_dispatch` to workflows by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2295
- Update supported versions in readme and in docs by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2684
- Prevent GH actions trigger on forks, update template by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2696
- Auto add `Platform: MacOS` label when `MacOS` is picked in the issue
by [@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2699
- Change eslint `ban-types` to warning. by
[@&#8203;m-bert](https://github.com/m-bert) in
[software-mansion/react-native-gesture-handler#2714
- Fix macOS warning message by
[@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2713
- Bump dependencies to stable React Native 0.73.2 by
[@&#8203;j-piasecki](https://github.com/j-piasecki) in
[software-mansion/react-native-gesture-handler#2698
- Add macOS app icon by [@&#8203;jfedak](https://github.com/jfedak) in
[software-mansion/react-native-gesture-handler#2723
- Bump follow-redirects from 1.15.3 to 1.15.4 in /e2e/web-tests by
[@&#8203;dependabot](https://github.com/dependabot) in
[software-mansion/react-native-gesture-handler#2719

#### New Contributors

- [@&#8203;mrousavy](https://github.com/mrousavy) made their first
contribution in
[software-mansion/react-native-gesture-handler#2690
- [@&#8203;HeroBanana](https://github.com/HeroBanana) made their first
contribution in
[software-mansion/react-native-gesture-handler#2588
- [@&#8203;fxamauri](https://github.com/fxamauri) made their first
contribution in
[software-mansion/react-native-gesture-handler#2712
- [@&#8203;jfedak](https://github.com/jfedak) made their first
contribution in
[software-mansion/react-native-gesture-handler#2713
- [@&#8203;computerjazz](https://github.com/computerjazz) made their
first contribution in
[software-mansion/react-native-gesture-handler#2715

**Full Changelog**:
software-mansion/react-native-gesture-handler@2.14.0...2.15.0

</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:eyJjcmVhdGVkSW5WZXIiOiIzNy4xNzMuMCIsInVwZGF0ZWRJblZlciI6IjM3LjE3My4wIiwidGFyZ2V0QnJhbmNoIjoibWFpbiJ9-->

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: valora-bot <valorabot@valoraapp.com>
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.

5 participants